List of usage examples for org.springframework.data.mongodb.core.mapping PersonWithObjectId getId
public ObjectId getId()
From source file:org.springframework.data.mongodb.core.mapping.MappingTests.java
@Test public void testPersonPojo() throws Exception { LOGGER.info("about to create new personpojo"); PersonWithObjectId p = new PersonWithObjectId(12345, "Person", "Pojo"); LOGGER.info("about to insert"); template.insert(p);/*from w ww. j av a2 s .co m*/ LOGGER.info("done inserting"); assertNotNull(p.getId()); List<PersonWithObjectId> result = template.find(new Query(Criteria.where("ssn").is(12345)), PersonWithObjectId.class); assertThat(result.size(), is(1)); assertThat(result.get(0).getSsn(), is(12345)); }