package org.greenrobot.greendao.daotest; import org.greenrobot.greendao.annotation.*; import org.greenrobot.greendao.daotest.DaoSession; import org.greenrobot.greendao.DaoException; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. Enable "keep" sections if you want to edit. /** * Entity mapped to table "RELATION_ENTITY". */ @Entity(active = true) public class RelationEntity { @Id private Long id; private Long parentId; private Long testId; private long testIdNotNull; private String simpleString; /** Used to resolve relations */ @Generated private transient DaoSession daoSession; /** Used for active entity operations. */ @Generated private transient RelationEntityDao myDao; @ToOne(joinProperty = "parentId") private RelationEntity parent; @Generated private transient Long parent__resolvedKey; @ToOne(joinProperty = "testId") private TestEntity testEntity; @Generated private transient Long testEntity__resolvedKey; @ToOne(joinProperty = "testIdNotNull") private TestEntity testNotNull; @Generated private transient Long testNotNull__resolvedKey; @ToOne @Property(nameInDb = "WITHOUT_PROPERTY_TEST_ID") private TestEntity testWithoutProperty; @Generated private transient boolean testWithoutProperty__refreshed; @Generated public RelationEntity() { } public RelationEntity(Long id) { this.id = id; } @Generated public RelationEntity(Long id, Long parentId, Long testId, long testIdNotNull, String simpleString) { this.id = id; this.parentId = parentId; this.testId = testId; this.testIdNotNull = testIdNotNull; this.simpleString = simpleString; } /** called by internal mechanisms, do not call yourself. */ @Generated public void __setDaoSession(DaoSession daoSession) { this.daoSession = daoSession; myDao = daoSession != null ? daoSession.getRelationEntityDao() : null; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Long getParentId() { return parentId; } public void setParentId(Long parentId) { this.parentId = parentId; } public Long getTestId() { return testId; } public void setTestId(Long testId) { this.testId = testId; } public long getTestIdNotNull() { return testIdNotNull; } public void setTestIdNotNull(long testIdNotNull) { this.testIdNotNull = testIdNotNull; } public String getSimpleString() { return simpleString; } public void setSimpleString(String simpleString) { this.simpleString = simpleString; } /** To-one relationship, resolved on first access. */ @Generated public RelationEntity getParent() { Long __key = this.parentId; if (parent__resolvedKey == null || !parent__resolvedKey.equals(__key)) { __throwIfDetached(); RelationEntityDao targetDao = daoSession.getRelationEntityDao(); RelationEntity parentNew = targetDao.load(__key); synchronized (this) { parent = parentNew; parent__resolvedKey = __key; } } return parent; } @Generated public void setParent(RelationEntity parent) { synchronized (this) { this.parent = parent; parentId = parent == null ? null : parent.getId(); parent__resolvedKey = parentId; } } /** 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; } @Generated public void setTestEntity(TestEntity testEntity) { synchronized (this) { this.testEntity = testEntity; testId = testEntity == null ? null : testEntity.getId(); testEntity__resolvedKey = testId; } } /** 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; } @Generated public void setTestNotNull(TestEntity testNotNull) { if (testNotNull == null) { throw new DaoException("To-one property 'testIdNotNull' has not-null constraint; cannot set to-one to null"); } synchronized (this) { this.testNotNull = testNotNull; testIdNotNull = testNotNull.getId(); testNotNull__resolvedKey = testIdNotNull; } } /** To-one relationship, resolved on first access. */ @Generated public TestEntity getTestWithoutProperty() { if (testWithoutProperty != null || !testWithoutProperty__refreshed) { __throwIfDetached(); TestEntityDao targetDao = daoSession.getTestEntityDao(); targetDao.refresh(testWithoutProperty); testWithoutProperty__refreshed = true; } return testWithoutProperty; } /** To-one relationship, returned entity is not refreshed and may carry only the PK property. */ @Generated public TestEntity peakTestWithoutProperty() { return testWithoutProperty; } @Generated public void setTestWithoutProperty(TestEntity testWithoutProperty) { synchronized (this) { this.testWithoutProperty = testWithoutProperty; testWithoutProperty__refreshed = true; } } /** * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}. * Entity must attached to an entity context. */ @Generated public void delete() { __throwIfDetached(); myDao.delete(this); } /** * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}. * Entity must attached to an entity context. */ @Generated public void update() { __throwIfDetached(); myDao.update(this); } /** * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}. * Entity must attached to an entity context. */ @Generated public void refresh() { __throwIfDetached(); myDao.refresh(this); } @Generated private void __throwIfDetached() { if (myDao == null) { throw new DaoException("Entity is detached from DAO context"); } } }