List of usage examples for org.springframework.data.mongodb.core.mapping PersonCustomCollection2 PersonCustomCollection2
public PersonCustomCollection2(Integer ssn, String firstName, String lastName)
From source file:org.springframework.data.mongodb.core.mapping.MappingTests.java
@Test public void testCustomCollectionInList() { List<BasePerson> persons = new ArrayList<BasePerson>(); persons.add(new PersonCustomCollection1(55555, "Person", "One")); persons.add(new PersonCustomCollection2(66666, "Person", "Two")); template.insertAll(persons);/*from w w w.java 2s . co m*/ List<PersonCustomCollection1> p1Results = template.find(new Query(Criteria.where("ssn").is(55555)), PersonCustomCollection1.class, "person1"); List<PersonCustomCollection2> p2Results = template.find(new Query(Criteria.where("ssn").is(66666)), PersonCustomCollection2.class, "person2"); assertThat(p1Results.size(), is(1)); assertThat(p2Results.size(), is(1)); }