com.j256.ormlite.dao
Class RuntimeExceptionDao<T,ID>

java.lang.Object
  extended by com.j256.ormlite.dao.RuntimeExceptionDao<T,ID>
All Implemented Interfaces:
CloseableIterable<T>, Iterable<T>

public class RuntimeExceptionDao<T,ID>
extends Object
implements CloseableIterable<T>

Proxy to a Dao that wraps each Exception and rethrows it as RuntimeException. You can use this if your usage pattern is to ignore all exceptions. That's not a pattern that I like so it's not the default.

 RuntimeExceptionDao<Account, String> accountDao = RuntimeExceptionDao.createDao(connectionSource, Account.class);
 

Author:
graywatson

Constructor Summary
RuntimeExceptionDao(Dao<T,ID> dao)
           
 
Method Summary
 void assignEmptyForeignCollection(T parent, String fieldName)
           
<CT> CT
callBatchTasks(Callable<CT> callable)
           
 void clearObjectCache()
           
 CloseableIterator<T> closeableIterator()
          Returns an iterator over a set of elements of type T which can be closed.
 void closeLastIterator()
           
 void commit(DatabaseConnection connection)
           
 long countOf()
           
 long countOf(PreparedQuery<T> preparedQuery)
           
 int create(T data)
           
static
<T,ID> RuntimeExceptionDao<T,ID>
createDao(ConnectionSource connectionSource, Class<T> clazz)
          Call through to DaoManager.createDao(ConnectionSource, Class) with the returned DAO wrapped in a RuntimeExceptionDao.
static
<T,ID> RuntimeExceptionDao<T,ID>
createDao(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig)
          Call through to DaoManager.createDao(ConnectionSource, DatabaseTableConfig) with the returned DAO wrapped in a RuntimeExceptionDao.
 T createIfNotExists(T data)
           
 Dao.CreateOrUpdateStatus createOrUpdate(T data)
           
 int delete(Collection<T> datas)
           
 int delete(PreparedDelete<T> preparedDelete)
           
 int delete(T data)
           
 DeleteBuilder<T,ID> deleteBuilder()
           
 int deleteById(ID id)
           
 int deleteIds(Collection<ID> ids)
           
 void endThreadConnection(DatabaseConnection connection)
           
 int executeRaw(String statement, String... arguments)
           
 int executeRawNoArgs(String statement)
           
 ID extractId(T data)
           
 FieldType findForeignFieldType(Class<?> clazz)
           
 ConnectionSource getConnectionSource()
           
 Class<T> getDataClass()
           
<FT> ForeignCollection<FT>
getEmptyForeignCollection(String fieldName)
           
 ObjectCache getObjectCache()
           
 RawRowMapper<T> getRawRowMapper()
           
 GenericRowMapper<T> getSelectStarRowMapper()
           
 CloseableWrappedIterable<T> getWrappedIterable()
           
 CloseableWrappedIterable<T> getWrappedIterable(PreparedQuery<T> preparedQuery)
           
 boolean idExists(ID id)
           
 boolean isAutoCommit()
          Deprecated. 
 boolean isAutoCommit(DatabaseConnection connection)
           
 boolean isTableExists()
           
 boolean isUpdatable()
           
 CloseableIterator<T> iterator()
           
 CloseableIterator<T> iterator(int resultFlags)
           
 CloseableIterator<T> iterator(PreparedQuery<T> preparedQuery)
           
 CloseableIterator<T> iterator(PreparedQuery<T> preparedQuery, int resultFlags)
           
 T mapSelectStarRow(DatabaseResults results)
           
 boolean objectsEqual(T data1, T data2)
           
 String objectToString(T data)
           
 List<T> query(PreparedQuery<T> preparedQuery)
           
 QueryBuilder<T,ID> queryBuilder()
           
 List<T> queryForAll()
           
 List<T> queryForEq(String fieldName, Object value)
           
 List<T> queryForFieldValues(Map<String,Object> fieldValues)
           
 List<T> queryForFieldValuesArgs(Map<String,Object> fieldValues)
           
 T queryForFirst(PreparedQuery<T> preparedQuery)
           
 T queryForId(ID id)
           
 List<T> queryForMatching(T matchObj)
           
 List<T> queryForMatchingArgs(T matchObj)
           
 T queryForSameId(T data)
           
 GenericRawResults<Object[]> queryRaw(String query, DataType[] columnTypes, String... arguments)
           
<UO> GenericRawResults<UO>
queryRaw(String query, RawRowMapper<UO> mapper, String... arguments)
           
 GenericRawResults<String[]> queryRaw(String query, String... arguments)
           
 long queryRawValue(String query, String... arguments)
           
 int refresh(T data)
           
 void rollBack(DatabaseConnection connection)
           
 void setAutoCommit(boolean autoCommit)
          Deprecated. 
 void setAutoCommit(DatabaseConnection connection, boolean autoCommit)
           
 void setObjectCache(boolean enabled)
           
 void setObjectCache(ObjectCache objectCache)
           
 void setObjectFactory(ObjectFactory<T> objectFactory)
           
 DatabaseConnection startThreadConnection()
           
 int update(PreparedUpdate<T> preparedUpdate)
           
 int update(T data)
           
 UpdateBuilder<T,ID> updateBuilder()
           
 int updateId(T data, ID newId)
           
 int updateRaw(String statement, String... arguments)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RuntimeExceptionDao

public RuntimeExceptionDao(Dao<T,ID> dao)
Method Detail

createDao

public static <T,ID> RuntimeExceptionDao<T,ID> createDao(ConnectionSource connectionSource,
                                                         Class<T> clazz)
                                           throws SQLException
Call through to DaoManager.createDao(ConnectionSource, Class) with the returned DAO wrapped in a RuntimeExceptionDao.

Throws:
SQLException

createDao

public static <T,ID> RuntimeExceptionDao<T,ID> createDao(ConnectionSource connectionSource,
                                                         DatabaseTableConfig<T> tableConfig)
                                           throws SQLException
Call through to DaoManager.createDao(ConnectionSource, DatabaseTableConfig) with the returned DAO wrapped in a RuntimeExceptionDao.

Throws:
SQLException

queryForId

public T queryForId(ID id)
See Also:
Dao.queryForId(Object)

queryForFirst

public T queryForFirst(PreparedQuery<T> preparedQuery)
See Also:
Dao.queryForFirst(PreparedQuery)

queryForAll

public List<T> queryForAll()
See Also:
Dao.queryForAll()

queryForEq

public List<T> queryForEq(String fieldName,
                          Object value)
See Also:
Dao.queryForEq(String, Object)

queryForMatching

public List<T> queryForMatching(T matchObj)
See Also:
Dao.queryForMatching(Object)

queryForMatchingArgs

public List<T> queryForMatchingArgs(T matchObj)
See Also:
Dao.queryForMatchingArgs(Object)

queryForFieldValues

public List<T> queryForFieldValues(Map<String,Object> fieldValues)
See Also:
Dao.queryForFieldValues(Map)

queryForFieldValuesArgs

public List<T> queryForFieldValuesArgs(Map<String,Object> fieldValues)
See Also:
Dao.queryForFieldValuesArgs(Map)

queryForSameId

public T queryForSameId(T data)
See Also:
Dao.queryForSameId(Object)

queryBuilder

public QueryBuilder<T,ID> queryBuilder()
See Also:
Dao.queryBuilder()

updateBuilder

public UpdateBuilder<T,ID> updateBuilder()
See Also:
Dao.updateBuilder()

deleteBuilder

public DeleteBuilder<T,ID> deleteBuilder()
See Also:
Dao.deleteBuilder()

query

public List<T> query(PreparedQuery<T> preparedQuery)
See Also:
Dao.query(PreparedQuery)

create

public int create(T data)
See Also:
Dao.create(Object)

createIfNotExists

public T createIfNotExists(T data)
See Also:
Dao.createIfNotExists(Object)

createOrUpdate

public Dao.CreateOrUpdateStatus createOrUpdate(T data)
See Also:
Dao.createOrUpdate(Object)

update

public int update(T data)
See Also:
Dao.update(Object)

updateId

public int updateId(T data,
                    ID newId)
See Also:
Dao.updateId(Object, Object)

update

public int update(PreparedUpdate<T> preparedUpdate)
See Also:
Dao.update(PreparedUpdate)

refresh

public int refresh(T data)
See Also:
Dao.refresh(Object)

delete

public int delete(T data)
See Also:
Dao.delete(Object)

deleteById

public int deleteById(ID id)
See Also:
Dao.deleteById(Object)

delete

public int delete(Collection<T> datas)
See Also:
Dao.delete(Collection)

deleteIds

public int deleteIds(Collection<ID> ids)
See Also:
Dao.deleteIds(Collection)

delete

public int delete(PreparedDelete<T> preparedDelete)
See Also:
Dao.delete(PreparedDelete)

iterator

public CloseableIterator<T> iterator()
Specified by:
iterator in interface Iterable<T>
See Also:
Dao.iterator()

closeableIterator

public CloseableIterator<T> closeableIterator()
Description copied from interface: CloseableIterable
Returns an iterator over a set of elements of type T which can be closed.

Specified by:
closeableIterator in interface CloseableIterable<T>

iterator

public CloseableIterator<T> iterator(int resultFlags)
See Also:
Dao.iterator(int)

getWrappedIterable

public CloseableWrappedIterable<T> getWrappedIterable()
See Also:
Dao.getWrappedIterable()

getWrappedIterable

public CloseableWrappedIterable<T> getWrappedIterable(PreparedQuery<T> preparedQuery)
See Also:
Dao.getWrappedIterable(PreparedQuery)

closeLastIterator

public void closeLastIterator()
See Also:
Dao.closeLastIterator()

iterator

public CloseableIterator<T> iterator(PreparedQuery<T> preparedQuery)
See Also:
Dao.iterator(PreparedQuery)

iterator

public CloseableIterator<T> iterator(PreparedQuery<T> preparedQuery,
                                     int resultFlags)
See Also:
Dao.iterator(PreparedQuery, int)

queryRaw

public GenericRawResults<String[]> queryRaw(String query,
                                            String... arguments)
See Also:
Dao.queryRaw(String, String...)

queryRawValue

public long queryRawValue(String query,
                          String... arguments)
See Also:
Dao.queryRawValue(String, String...)

queryRaw

public <UO> GenericRawResults<UO> queryRaw(String query,
                                           RawRowMapper<UO> mapper,
                                           String... arguments)
See Also:
Dao.queryRaw(String, RawRowMapper, String...)

queryRaw

public GenericRawResults<Object[]> queryRaw(String query,
                                            DataType[] columnTypes,
                                            String... arguments)
See Also:
Dao.queryRaw(String, DataType[], String...)

executeRaw

public int executeRaw(String statement,
                      String... arguments)
See Also:
Dao.executeRaw(String, String...)

executeRawNoArgs

public int executeRawNoArgs(String statement)
See Also:
Dao.executeRawNoArgs(String)

updateRaw

public int updateRaw(String statement,
                     String... arguments)
See Also:
Dao.updateRaw(String, String...)

callBatchTasks

public <CT> CT callBatchTasks(Callable<CT> callable)
See Also:
Dao.callBatchTasks(Callable)

objectToString

public String objectToString(T data)
See Also:
Dao.objectToString(Object)

objectsEqual

public boolean objectsEqual(T data1,
                            T data2)
See Also:
Dao.objectsEqual(Object, Object)

extractId

public ID extractId(T data)
See Also:
Dao.extractId(Object)

getDataClass

public Class<T> getDataClass()
See Also:
Dao.getDataClass()

findForeignFieldType

public FieldType findForeignFieldType(Class<?> clazz)
See Also:
Dao.findForeignFieldType(Class)

isUpdatable

public boolean isUpdatable()
See Also:
Dao.isUpdatable()

isTableExists

public boolean isTableExists()
See Also:
Dao.isTableExists()

countOf

public long countOf()
See Also:
Dao.countOf()

countOf

public long countOf(PreparedQuery<T> preparedQuery)
See Also:
Dao.countOf(PreparedQuery)

assignEmptyForeignCollection

public void assignEmptyForeignCollection(T parent,
                                         String fieldName)
See Also:
Dao.assignEmptyForeignCollection(Object, String)

getEmptyForeignCollection

public <FT> ForeignCollection<FT> getEmptyForeignCollection(String fieldName)
See Also:
Dao.getEmptyForeignCollection(String)

setObjectCache

public void setObjectCache(boolean enabled)
See Also:
Dao.setObjectCache(boolean)

getObjectCache

public ObjectCache getObjectCache()
See Also:
Dao.getObjectCache()

setObjectCache

public void setObjectCache(ObjectCache objectCache)
See Also:
Dao.setObjectCache(ObjectCache)

clearObjectCache

public void clearObjectCache()
See Also:
Dao.clearObjectCache()

mapSelectStarRow

public T mapSelectStarRow(DatabaseResults results)
See Also:
Dao.mapSelectStarRow(DatabaseResults)

getSelectStarRowMapper

public GenericRowMapper<T> getSelectStarRowMapper()
See Also:
Dao.getSelectStarRowMapper()

idExists

public boolean idExists(ID id)
See Also:
Dao.idExists(Object)

startThreadConnection

public DatabaseConnection startThreadConnection()
See Also:
Dao.startThreadConnection()

endThreadConnection

public void endThreadConnection(DatabaseConnection connection)
See Also:
Dao.endThreadConnection(DatabaseConnection)

setAutoCommit

@Deprecated
public void setAutoCommit(boolean autoCommit)
Deprecated. 

See Also:
Dao.setAutoCommit(boolean)

setAutoCommit

public void setAutoCommit(DatabaseConnection connection,
                          boolean autoCommit)
See Also:
Dao.setAutoCommit(DatabaseConnection, boolean)

isAutoCommit

@Deprecated
public boolean isAutoCommit()
Deprecated. 

See Also:
Dao.isAutoCommit()

isAutoCommit

public boolean isAutoCommit(DatabaseConnection connection)
See Also:
Dao.isAutoCommit(DatabaseConnection)

commit

public void commit(DatabaseConnection connection)
See Also:
Dao.commit(DatabaseConnection)

rollBack

public void rollBack(DatabaseConnection connection)
See Also:
Dao.rollBack(DatabaseConnection)

setObjectFactory

public void setObjectFactory(ObjectFactory<T> objectFactory)
See Also:
Dao.setObjectFactory(ObjectFactory)

getRawRowMapper

public RawRowMapper<T> getRawRowMapper()
See Also:
Dao.getRawRowMapper()

getConnectionSource

public ConnectionSource getConnectionSource()
See Also:
Dao.getConnectionSource()


This documentation is licensed by Gray Watson under the Creative Commons Attribution-Share Alike 3.0 License.