Example usage for org.springframework.data.mongodb.core.mapping PersonCustomCollection1 PersonCustomCollection1

List of usage examples for org.springframework.data.mongodb.core.mapping PersonCustomCollection1 PersonCustomCollection1

Introduction

In this page you can find the example usage for org.springframework.data.mongodb.core.mapping PersonCustomCollection1 PersonCustomCollection1.

Prototype

public PersonCustomCollection1(Integer ssn, String firstName, String lastName) 

Source Link

Usage

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  ww.j  a v a  2s .c om*/

    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));
}