public class PersistenceDao<T,ID> extends Object implements com.j256.ormlite.dao.CloseableIterable<T>
Dao that wraps each Exception and rethrows it as PersistenceException.
PersistenceDao<Account, String> accountDao = PersistenceDao.createDao(connectionSource, Account.class);
| Constructor and Description |
|---|
PersistenceDao(com.j256.ormlite.dao.Dao<T,ID> dao) |
| Modifier and Type | Method and Description |
|---|---|
void |
assignEmptyForeignCollection(T parent,
String fieldName) |
<CT> CT |
callBatchTasks(Callable<CT> callable) |
void |
clearObjectCache() |
com.j256.ormlite.dao.CloseableIterator<T> |
closeableIterator() |
void |
closeLastIterator() |
void |
commit(com.j256.ormlite.support.DatabaseConnection connection) |
long |
countOf() |
long |
countOf(com.j256.ormlite.stmt.PreparedQuery<T> preparedQuery) |
int |
create(Collection<T> datas) |
int |
create(T data) |
static <T,ID> PersistenceDao<T,ID> |
createDao(com.j256.ormlite.support.ConnectionSource connectionSource,
Class<T> clazz)
Call through to
DaoManager.createDao(ConnectionSource, Class) with the returned DAO wrapped in a
PersistenceDao. |
static <T,ID> PersistenceDao<T,ID> |
createDao(com.j256.ormlite.support.ConnectionSource connectionSource,
com.j256.ormlite.table.DatabaseTableConfig<T> tableConfig)
Call through to
DaoManager.createDao(ConnectionSource, DatabaseTableConfig) with the returned DAO wrapped
in a PersistenceDao. |
T |
createIfNotExists(T data) |
com.j256.ormlite.dao.Dao.CreateOrUpdateStatus |
createOrUpdate(T data) |
int |
delete(Collection<T> datas) |
int |
delete(com.j256.ormlite.stmt.PreparedDelete<T> preparedDelete) |
int |
delete(T data) |
com.j256.ormlite.stmt.DeleteBuilder<T,ID> |
deleteBuilder() |
int |
deleteById(ID id) |
int |
deleteIds(Collection<ID> ids) |
void |
endThreadConnection(com.j256.ormlite.support.DatabaseConnection connection) |
int |
executeRaw(String statement,
String... arguments) |
int |
executeRawNoArgs(String statement) |
ID |
extractId(T data) |
com.j256.ormlite.field.FieldType |
findForeignFieldType(Class<?> clazz) |
com.j256.ormlite.support.ConnectionSource |
getConnectionSource() |
Class<T> |
getDataClass() |
<FT> com.j256.ormlite.dao.ForeignCollection<FT> |
getEmptyForeignCollection(String fieldName) |
com.j256.ormlite.dao.ObjectCache |
getObjectCache() |
com.j256.ormlite.dao.RawRowMapper<T> |
getRawRowMapper() |
com.j256.ormlite.stmt.GenericRowMapper<T> |
getSelectStarRowMapper() |
com.j256.ormlite.dao.CloseableWrappedIterable<T> |
getWrappedIterable() |
com.j256.ormlite.dao.CloseableWrappedIterable<T> |
getWrappedIterable(com.j256.ormlite.stmt.PreparedQuery<T> preparedQuery) |
boolean |
idExists(ID id) |
boolean |
isAutoCommit()
Deprecated.
|
boolean |
isAutoCommit(com.j256.ormlite.support.DatabaseConnection connection) |
boolean |
isTableExists() |
boolean |
isUpdatable() |
com.j256.ormlite.dao.CloseableIterator<T> |
iterator() |
com.j256.ormlite.dao.CloseableIterator<T> |
iterator(int resultFlags) |
com.j256.ormlite.dao.CloseableIterator<T> |
iterator(com.j256.ormlite.stmt.PreparedQuery<T> preparedQuery) |
com.j256.ormlite.dao.CloseableIterator<T> |
iterator(com.j256.ormlite.stmt.PreparedQuery<T> preparedQuery,
int resultFlags) |
T |
mapSelectStarRow(com.j256.ormlite.support.DatabaseResults results) |
void |
notifyChanges() |
boolean |
objectsEqual(T data1,
T data2) |
String |
objectToString(T data) |
List<T> |
query(com.j256.ormlite.stmt.PreparedQuery<T> preparedQuery) |
com.j256.ormlite.stmt.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(com.j256.ormlite.stmt.PreparedQuery<T> preparedQuery) |
T |
queryForId(ID id) |
List<T> |
queryForMatching(T matchObj) |
List<T> |
queryForMatchingArgs(T matchObj) |
T |
queryForSameId(T data) |
<UO> com.j256.ormlite.dao.GenericRawResults<UO> |
queryRaw(String query,
com.j256.ormlite.dao.DatabaseResultsMapper<UO> mapper,
String... arguments) |
<UO> com.j256.ormlite.dao.GenericRawResults<UO> |
queryRaw(String query,
com.j256.ormlite.field.DataType[] columnTypes,
com.j256.ormlite.dao.RawRowObjectMapper<UO> mapper,
String... arguments) |
com.j256.ormlite.dao.GenericRawResults<Object[]> |
queryRaw(String query,
com.j256.ormlite.field.DataType[] columnTypes,
String... arguments) |
<UO> com.j256.ormlite.dao.GenericRawResults<UO> |
queryRaw(String query,
com.j256.ormlite.dao.RawRowMapper<UO> mapper,
String... arguments) |
com.j256.ormlite.dao.GenericRawResults<String[]> |
queryRaw(String query,
String... arguments) |
long |
queryRawValue(String query,
String... arguments) |
int |
refresh(T data) |
void |
registerObserver(com.j256.ormlite.dao.Dao.DaoObserver observer) |
void |
rollBack(com.j256.ormlite.support.DatabaseConnection connection) |
void |
setAutoCommit(boolean autoCommit)
Deprecated.
|
void |
setAutoCommit(com.j256.ormlite.support.DatabaseConnection connection,
boolean autoCommit) |
void |
setObjectCache(boolean enabled) |
void |
setObjectCache(com.j256.ormlite.dao.ObjectCache objectCache) |
void |
setObjectFactory(com.j256.ormlite.table.ObjectFactory<T> objectFactory) |
com.j256.ormlite.support.DatabaseConnection |
startThreadConnection() |
void |
unregisterObserver(com.j256.ormlite.dao.Dao.DaoObserver observer) |
int |
update(com.j256.ormlite.stmt.PreparedUpdate<T> preparedUpdate) |
int |
update(T data) |
com.j256.ormlite.stmt.UpdateBuilder<T,ID> |
updateBuilder() |
int |
updateId(T data,
ID newId) |
int |
updateRaw(String statement,
String... arguments) |
public static <T,ID> PersistenceDao<T,ID> createDao(com.j256.ormlite.support.ConnectionSource connectionSource, Class<T> clazz) throws SQLException
DaoManager.createDao(ConnectionSource, Class) with the returned DAO wrapped in a
PersistenceDao.SQLExceptionpublic static <T,ID> PersistenceDao<T,ID> createDao(com.j256.ormlite.support.ConnectionSource connectionSource, com.j256.ormlite.table.DatabaseTableConfig<T> tableConfig) throws SQLException
DaoManager.createDao(ConnectionSource, DatabaseTableConfig) with the returned DAO wrapped
in a PersistenceDao.SQLExceptionpublic T queryForFirst(com.j256.ormlite.stmt.PreparedQuery<T> preparedQuery)
Dao.queryForFirst(PreparedQuery)public List<T> queryForEq(String fieldName, Object value)
Dao.queryForEq(String, Object)public List<T> queryForMatchingArgs(T matchObj)
Dao.queryForMatchingArgs(Object)public List<T> queryForFieldValues(Map<String,Object> fieldValues)
Dao.queryForFieldValues(Map)public List<T> queryForFieldValuesArgs(Map<String,Object> fieldValues)
Dao.queryForFieldValuesArgs(Map)public com.j256.ormlite.stmt.QueryBuilder<T,ID> queryBuilder()
Dao.queryBuilder()public com.j256.ormlite.stmt.UpdateBuilder<T,ID> updateBuilder()
Dao.updateBuilder()public com.j256.ormlite.stmt.DeleteBuilder<T,ID> deleteBuilder()
Dao.deleteBuilder()public List<T> query(com.j256.ormlite.stmt.PreparedQuery<T> preparedQuery)
Dao.query(PreparedQuery)public int create(T data)
Dao.create(Object)public int create(Collection<T> datas)
public com.j256.ormlite.dao.Dao.CreateOrUpdateStatus createOrUpdate(T data)
Dao.createOrUpdate(Object)public int update(T data)
Dao.update(Object)public int update(com.j256.ormlite.stmt.PreparedUpdate<T> preparedUpdate)
Dao.update(PreparedUpdate)public int refresh(T data)
Dao.refresh(Object)public int delete(T data)
Dao.delete(Object)public int deleteById(ID id)
Dao.deleteById(Object)public int delete(Collection<T> datas)
Dao.delete(Collection)public int deleteIds(Collection<ID> ids)
Dao.deleteIds(Collection)public int delete(com.j256.ormlite.stmt.PreparedDelete<T> preparedDelete)
Dao.delete(PreparedDelete)public com.j256.ormlite.dao.CloseableIterator<T> iterator()
public com.j256.ormlite.dao.CloseableIterator<T> closeableIterator()
closeableIterator in interface com.j256.ormlite.dao.CloseableIterable<T>public com.j256.ormlite.dao.CloseableIterator<T> iterator(int resultFlags)
Dao.iterator(int)public com.j256.ormlite.dao.CloseableWrappedIterable<T> getWrappedIterable()
Dao.getWrappedIterable()public com.j256.ormlite.dao.CloseableWrappedIterable<T> getWrappedIterable(com.j256.ormlite.stmt.PreparedQuery<T> preparedQuery)
Dao.getWrappedIterable(PreparedQuery)public void closeLastIterator()
Dao.closeLastIterator()public com.j256.ormlite.dao.CloseableIterator<T> iterator(com.j256.ormlite.stmt.PreparedQuery<T> preparedQuery)
Dao.iterator(PreparedQuery)public com.j256.ormlite.dao.CloseableIterator<T> iterator(com.j256.ormlite.stmt.PreparedQuery<T> preparedQuery, int resultFlags)
Dao.iterator(PreparedQuery, int)public com.j256.ormlite.dao.GenericRawResults<String[]> queryRaw(String query, String... arguments)
Dao.queryRaw(String, String...)public <UO> com.j256.ormlite.dao.GenericRawResults<UO> queryRaw(String query, com.j256.ormlite.dao.DatabaseResultsMapper<UO> mapper, String... arguments)
Dao.queryRaw(String, DatabaseResultsMapper, String...)public long queryRawValue(String query, String... arguments)
Dao.queryRawValue(String, String...)public <UO> com.j256.ormlite.dao.GenericRawResults<UO> queryRaw(String query, com.j256.ormlite.dao.RawRowMapper<UO> mapper, String... arguments)
Dao.queryRaw(String, RawRowMapper, String...)public <UO> com.j256.ormlite.dao.GenericRawResults<UO> queryRaw(String query, com.j256.ormlite.field.DataType[] columnTypes, com.j256.ormlite.dao.RawRowObjectMapper<UO> mapper, String... arguments)
Dao.queryRaw(String, DataType[], RawRowObjectMapper, String...)public com.j256.ormlite.dao.GenericRawResults<Object[]> queryRaw(String query, com.j256.ormlite.field.DataType[] columnTypes, String... arguments)
Dao.queryRaw(String, DataType[], String...)public int executeRaw(String statement, String... arguments)
Dao.executeRaw(String, String...)public int executeRawNoArgs(String statement)
Dao.executeRawNoArgs(String)public int updateRaw(String statement, String... arguments)
Dao.updateRaw(String, String...)public <CT> CT callBatchTasks(Callable<CT> callable)
Dao.callBatchTasks(Callable)public boolean objectsEqual(T data1, T data2)
Dao.objectsEqual(Object, Object)public com.j256.ormlite.field.FieldType findForeignFieldType(Class<?> clazz)
Dao.findForeignFieldType(Class)public boolean isUpdatable()
Dao.isUpdatable()public boolean isTableExists()
Dao.isTableExists()public long countOf()
Dao.countOf()public long countOf(com.j256.ormlite.stmt.PreparedQuery<T> preparedQuery)
Dao.countOf(PreparedQuery)public void assignEmptyForeignCollection(T parent, String fieldName)
Dao.assignEmptyForeignCollection(Object, String)public <FT> com.j256.ormlite.dao.ForeignCollection<FT> getEmptyForeignCollection(String fieldName)
Dao.getEmptyForeignCollection(String)public void setObjectCache(boolean enabled)
Dao.setObjectCache(boolean)public com.j256.ormlite.dao.ObjectCache getObjectCache()
Dao.getObjectCache()public void setObjectCache(com.j256.ormlite.dao.ObjectCache objectCache)
Dao.setObjectCache(ObjectCache)public void clearObjectCache()
Dao.clearObjectCache()public T mapSelectStarRow(com.j256.ormlite.support.DatabaseResults results)
Dao.mapSelectStarRow(DatabaseResults)public com.j256.ormlite.stmt.GenericRowMapper<T> getSelectStarRowMapper()
Dao.getSelectStarRowMapper()public boolean idExists(ID id)
Dao.idExists(Object)public com.j256.ormlite.support.DatabaseConnection startThreadConnection()
Dao.startThreadConnection()public void endThreadConnection(com.j256.ormlite.support.DatabaseConnection connection)
Dao.endThreadConnection(DatabaseConnection)@Deprecated public void setAutoCommit(boolean autoCommit)
Dao.setAutoCommit(boolean)public void setAutoCommit(com.j256.ormlite.support.DatabaseConnection connection,
boolean autoCommit)
Dao.setAutoCommit(DatabaseConnection, boolean)@Deprecated public boolean isAutoCommit()
Dao.isAutoCommit()public boolean isAutoCommit(com.j256.ormlite.support.DatabaseConnection connection)
Dao.isAutoCommit(DatabaseConnection)public void commit(com.j256.ormlite.support.DatabaseConnection connection)
Dao.commit(DatabaseConnection)public void rollBack(com.j256.ormlite.support.DatabaseConnection connection)
Dao.rollBack(DatabaseConnection)public void setObjectFactory(com.j256.ormlite.table.ObjectFactory<T> objectFactory)
Dao.setObjectFactory(ObjectFactory)public com.j256.ormlite.dao.RawRowMapper<T> getRawRowMapper()
Dao.getRawRowMapper()public com.j256.ormlite.support.ConnectionSource getConnectionSource()
Dao.getConnectionSource()public void registerObserver(com.j256.ormlite.dao.Dao.DaoObserver observer)
public void unregisterObserver(com.j256.ormlite.dao.Dao.DaoObserver observer)
public void notifyChanges()
This documentation is licensed by Andrew Bowley under the GPLv3 License.