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

java.lang.Object
  extended by com.j256.ormlite.dao.RuntimeExceptionDao<T,ID>

public class RuntimeExceptionDao<T,ID>
extends Object

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
<CT> CT
callBatchTasks(Callable<CT> callable)
           
 void clearObjectCache()
           
 void closeLastIterator()
           
 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)
           
 int executeRaw(String statement, String... arguments)
           
 ID extractId(T data)
           
 FieldType findForeignFieldType(Class<?> clazz)
           
 Class<T> getDataClass()
           
<FT> ForeignCollection<FT>
getEmptyForeignCollection(String fieldName)
           
 ObjectCache getObjectCache()
           
 CloseableWrappedIterable<T> getWrappedIterable()
           
 CloseableWrappedIterable<T> getWrappedIterable(PreparedQuery<T> preparedQuery)
           
 boolean isTableExists()
           
 boolean isUpdatable()
           
 CloseableIterator<T> iterator()
           
 CloseableIterator<T> iterator(PreparedQuery<T> preparedQuery)
           
 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)
           
 int refresh(T data)
           
 void setObjectCache(boolean enabled)
           
 void setObjectCache(ObjectCache objectCache)
           
 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()
See Also:
Dao.iterator()

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)

queryRaw

public GenericRawResults<String[]> queryRaw(String query,
                                            String... arguments)
See Also:
Dao.queryRaw(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...)

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))

getEmptyForeignCollection

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

setObjectCache

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

getObjectCache

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

setObjectCache

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

clearObjectCache

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


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