@Generated private void __throwIfDetached() { if (myDao == null) { throw new DaoException("Entity is detached from DAO context"); } }
protected void safeInitCause(Throwable cause) { try { initCause(cause); } catch (Throwable e) { DaoLog.e("Could not set initial cause", e); DaoLog.e( "Initial cause is:", cause); } }
public DaoException(String error, Throwable cause) { super(error); safeInitCause(cause); }
@Test public void testMockitoMocks() { mock(DaoMaster.class).newSession(); mock(DaoSession.class).getDatabase(); mock(Database.class).getRawDatabase(); mock(DatabaseStatement.class).execute(); mock(IdentityScope.class).clear(); mock(AbstractDao.class).queryBuilder(); mock(MinimalEntityDao.class).queryBuilder(); mock(MinimalEntity.class).getId(); mock(Query.class).forCurrentThread(); mock(QueryBuilder.class).build(); mock(CountQuery.class).forCurrentThread(); mock(DeleteQuery.class).forCurrentThread(); mock(Join.class).getTablePrefix(); mock(LazyList.class).getLoadedCount(); mock(WhereCondition.class).appendValuesTo(null); mock(Property.class).isNull(); mock(DaoException.class).getMessage(); }
public void testSublistUncached() { ArrayList<TestEntity> list = insert(10); LazyList<TestEntity> listLazy = dao.queryBuilder().orderAsc(Properties.SimpleInteger).build().listLazyUncached(); try { assertIds(list.subList(2,7), listLazy.subList(2,7)); } catch (DaoException e) { assertEquals("This operation only works with cached lazy lists", e.getMessage()); } }
@Generated private void __throwIfDetached() { if (myDao == null) { throw new DaoException("Entity is detached from DAO context"); } }
public DaoException(Throwable th) { safeInitCause(th); }
protected void safeInitCause(Throwable cause) { try { initCause(cause); } catch (Throwable e) { DaoLog.e("Could not set initial cause", e); DaoLog.e( "Initial cause is:", cause); } }
public void testJoinDelete() { prepareData(); QueryBuilder<RelationEntity> queryBuilder = createQueryBuilder(5); try { queryBuilder.buildDelete().executeDeleteWithoutDetachingEntities(); } catch (DaoException e) { assertEquals("JOINs are not supported for DELETE queries", e.getMessage()); return; } // Never executed, unsupported by SQLite assertEquals(9, relationEntityDao.count()); assertEquals(10, testEntityDao.count()); assertNull(relationEntityDao.queryBuilder().where(Properties.SimpleString.eq("entity-5")).unique()); }
@Generated private void __throwIfDetached() { if (myDao == null) { throw new DaoException("Entity is detached from DAO context"); } }
public DaoException(String error, Throwable cause) { super(error); safeInitCause(cause); }
@Generated private void __throwIfDetached() { if (myDao == null) { throw new DaoException("Entity is detached from DAO context"); } }
public DaoException(Throwable th) { safeInitCause(th); }
protected void assertSinglePk() { if (config.pkColumns.length != 1) { throw new DaoException(this + " (" + config.tablename + ") does not have a single-column primary key"); } }
public long getDuration() { if (timeCompleted == 0) { throw new DaoException("This operation did not yet complete"); } else { return timeCompleted - timeStarted; } }
@Generated private void __throwIfDetached() { if (myDao == null) { throw new DaoException("Entity is detached from DAO context"); } }
protected void checkCached() { if (entities == null) { throw new DaoException("This operation only works with cached lazy lists"); } }
public AbstractDao<?, ?> getDao(Class<? extends Object> entityClass) { AbstractDao<?, ?> dao = entityToDao.get(entityClass); if (dao == null) { throw new DaoException("No DAO registered for " + entityClass); } return dao; }
protected void checkThread() { if (Thread.currentThread() != ownerThread) { throw new DaoException( "Method may be called only in owner thread, use forCurrentThread to get an instance for this thread"); } }
/** * Waits until the operation is complete, but at most the given amount of milliseconds.If the thread gets * interrupted, any {@link InterruptedException} will be rethrown as a {@link DaoException}. * * @return true if the operation completed in the given time frame. */ public synchronized boolean waitForCompletion(int maxMillis) { if (!completed) { try { wait(maxMillis); } catch (InterruptedException e) { throw new DaoException("Interrupted while waiting for operation to complete", e); } } return completed; }