List of usage examples for org.springframework.data.mongodb.core.mapping PersonWithLongDBRef PersonWithLongDBRef
public PersonWithLongDBRef(Integer ssn, String firstName, String lastName, PersonPojoLongId personPojoLongId)
From source file:org.springframework.data.mongodb.core.mapping.MappingTests.java
@Test public void testPersonWithLongDBRef() { PersonPojoLongId personPojoLongId = new PersonPojoLongId(12L, "PersonWithLongDBRef"); template.insert(personPojoLongId);/*from w w w . j av a2 s . com*/ PersonWithLongDBRef personWithLongDBRef = new PersonWithLongDBRef(21, "PersonWith", "LongDBRef", personPojoLongId); template.insert(personWithLongDBRef); Query q = query(where("ssn").is(21)); PersonWithLongDBRef p2 = template.findOne(q, PersonWithLongDBRef.class); assertNotNull(p2); assertNotNull(p2.getPersonPojoLongId()); assertEquals(12L, p2.getPersonPojoLongId().getId()); }