/** * 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#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#refresh(Object)}. * Entity must attached to an entity context. */ @Generated public void refresh() { __throwIfDetached(); myDao.refresh(this); }
private void doTestAlwaysAttached(Thread thread) throws Exception { thread.start(); Field daoSessionField = AnActiveEntity.class.getDeclaredField("daoSession"); daoSessionField.setAccessible(true); int countEntity = 0; countDownAndAwaitLatch(); try { assertTrue(latch.await(10, TimeUnit.SECONDS)); for (int i = 0;; i++) { AnActiveEntity entity = dao.load(1l); if (entity != null) { countEntity++; assertNotNull(daoSessionField.get(entity)); } if (i == 1000000 && countEntity == 0) { fail("No entity available"); } if (countEntity % 10000 == 0) { DaoLog.d("Checked entities " + countEntity + " in " + i + " iterations"); } if (countEntity == ENTITIES_TO_CHECK) { break; } } } finally { running = false; thread.join(); } }
joinManyToDateEntityDao = new JoinManyToDateEntityDao(joinManyToDateEntityDaoConfig, this); treeEntityDao = new TreeEntityDao(treeEntityDaoConfig, this); anActiveEntityDao = new AnActiveEntityDao(anActiveEntityDaoConfig, this); extendsImplementsEntityDao = new ExtendsImplementsEntityDao(extendsImplementsEntityDaoConfig, this); stringKeyValueEntityDao = new StringKeyValueEntityDao(stringKeyValueEntityDaoConfig, this);
/** Creates underlying database table using DAOs. */ public static void createAllTables(Database db, boolean ifNotExists) { SimpleEntityDao.createTable(db, ifNotExists); SimpleEntityNotNullDao.createTable(db, ifNotExists); TestEntityDao.createTable(db, ifNotExists); RelationEntityDao.createTable(db, ifNotExists); DateEntityDao.createTable(db, ifNotExists); SpecialNamesEntityDao.createTable(db, ifNotExists); AbcdefEntityDao.createTable(db, ifNotExists); ToManyTargetEntityDao.createTable(db, ifNotExists); ToManyEntityDao.createTable(db, ifNotExists); JoinManyToDateEntityDao.createTable(db, ifNotExists); TreeEntityDao.createTable(db, ifNotExists); AnActiveEntityDao.createTable(db, ifNotExists); ExtendsImplementsEntityDao.createTable(db, ifNotExists); StringKeyValueEntityDao.createTable(db, ifNotExists); AutoincrementEntityDao.createTable(db, ifNotExists); CustomTypeEntityDao.createTable(db, ifNotExists); IndexedStringEntityDao.createTable(db, ifNotExists); }
/** Drops underlying database table using DAOs. */ public static void dropAllTables(Database db, boolean ifExists) { SimpleEntityDao.dropTable(db, ifExists); SimpleEntityNotNullDao.dropTable(db, ifExists); TestEntityDao.dropTable(db, ifExists); RelationEntityDao.dropTable(db, ifExists); DateEntityDao.dropTable(db, ifExists); SpecialNamesEntityDao.dropTable(db, ifExists); AbcdefEntityDao.dropTable(db, ifExists); ToManyTargetEntityDao.dropTable(db, ifExists); ToManyEntityDao.dropTable(db, ifExists); JoinManyToDateEntityDao.dropTable(db, ifExists); TreeEntityDao.dropTable(db, ifExists); AnActiveEntityDao.dropTable(db, ifExists); ExtendsImplementsEntityDao.dropTable(db, ifExists); StringKeyValueEntityDao.dropTable(db, ifExists); AutoincrementEntityDao.dropTable(db, ifExists); CustomTypeEntityDao.dropTable(db, ifExists); IndexedStringEntityDao.dropTable(db, ifExists); }