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