Example usage for org.springframework.data.mongodb.core.mapping PersonWithLongDBRef getPersonPojoLongId

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

Introduction

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

Prototype

public PersonPojoLongId getPersonPojoLongId() 

Source Link

Usage

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

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