Search in sources :

Example 1 with LazyChild

use of com.orientechnologies.orient.test.domain.lazy.LazyChild in project orientdb by orientechnologies.

the class ObjectDetachingTest method testDetachAllWithLazyOneToOne.

public void testDetachAllWithLazyOneToOne() {
    database.getEntityManager().registerEntityClasses("com.orientechnologies.orient.test.domain.lazy");
    LazyParent parent = new LazyParent();
    LazyChild theChild = new LazyChild();
    theChild.setName("name");
    parent.setChild(theChild);
    LazyParent saved = database.save(parent);
    saved.setChildCopy(saved.getChild());
    LazyParent detached = database.detachAll(saved, true);
    Assert.assertNotNull(detached.getChild().getId());
    Assert.assertNull(detached.getChild().getName());
    Assert.assertSame(detached.getChild(), detached.getChildCopy());
    LazyChild loaded = database.load(detached.getChild().getId());
    Assert.assertEquals("name", loaded.getName());
}
Also used : LazyParent(com.orientechnologies.orient.test.domain.lazy.LazyParent) LazyChild(com.orientechnologies.orient.test.domain.lazy.LazyChild)

Aggregations

LazyChild (com.orientechnologies.orient.test.domain.lazy.LazyChild)1 LazyParent (com.orientechnologies.orient.test.domain.lazy.LazyParent)1