/** To-one relationship, resolved on first access. */ @Generated public TestEntity getTestEntity() { Long __key = this.testId; if (testEntity__resolvedKey == null || !testEntity__resolvedKey.equals(__key)) { __throwIfDetached(); TestEntityDao targetDao = daoSession.getTestEntityDao(); TestEntity testEntityNew = targetDao.load(__key); synchronized (this) { testEntity = testEntityNew; testEntity__resolvedKey = __key; } } return testEntity; }
/** To-one relationship, resolved on first access. */ @Generated public TestEntity getTestNotNull() { long __key = this.testIdNotNull; if (testNotNull__resolvedKey == null || !testNotNull__resolvedKey.equals(__key)) { __throwIfDetached(); TestEntityDao targetDao = daoSession.getTestEntityDao(); TestEntity testNotNullNew = targetDao.load(__key); synchronized (this) { testNotNull = testNotNullNew; testNotNull__resolvedKey = __key; } } return testNotNull; }
public void testDetachAll() { TestEntity entity1 = createEntity(null); TestEntity entity2 = createEntity(null); dao.insertInTx(entity1, entity2); dao.detachAll(); TestEntity entity1a = dao.load(entity1.getId()); TestEntity entity2a = dao.load(entity2.getId()); assertNotSame(entity1, entity1a); assertNotSame(entity2, entity2a); }
public void testDetach() { TestEntity entity = createEntity(null); dao.insert(entity); dao.detach(entity); TestEntity entity2 = dao.load(entity.getId()); dao.detach(entity2); TestEntity entity3 = dao.load(entity.getId()); assertNotSame(entity, entity2); assertNotSame(entity2, entity3); assertNotSame(entity, entity3); }
protected RelationEntity insertEntityWithRelations(Long testEntityId) { TestEntity testEntity = daoSession.getTestEntityDao().load(testEntityId); if (testEntity == null) { testEntity = new TestEntity(testEntityId); testEntity.setSimpleStringNotNull("mytest"); daoSession.getTestEntityDao().insert(testEntity); } RelationEntity parentEntity = createEntity(null); parentEntity.setSimpleString("I'm a parent"); parentEntity.setTestNotNull(testEntity); dao.insert(parentEntity); RelationEntity entity = createEntity(null); entity.setTestId(testEntityId); entity.setParentId(parentEntity.getId()); entity.setSimpleString("findMe"); entity.setTestNotNull(testEntity); dao.insert(entity); return entity; }