|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.greenrobot.dao.AbstractDaoSession
public class AbstractDaoSession
DaoSession gives you access to your DAOs, offers convenient persistence methods, and also serves as a session cache.
To access the DAOs, call the get{entity}Dao methods by the generated DaoSession sub class.
DaoSession offers many of the available persistence operations on entities as a convenience. Consider using DAOs
directly to access all available operations, especially if you call a lot of operations on a single entity type to
avoid the overhead imposed by DaoSession (the overhead is small, but it may add up).
By default, the DaoSession has a session cache (IdentityScopeType.Session). The session cache is not just a plain
data cache to improve performance, but also manages object identities. For example, if you load the same entity twice
in a query, you will get a single Java object instead of two when using a session cache. This is particular useful
for relations pointing to a common set of entities.
This class is thread-safe.
| Constructor Summary | |
|---|---|
AbstractDaoSession(SQLiteDatabase db)
|
|
| Method Summary | ||
|---|---|---|
|
callInTx(java.util.concurrent.Callable<V> callable)
Calls the given Callable inside a database transaction and returns the result of the Callable. |
|
|
callInTxNoException(java.util.concurrent.Callable<V> callable)
Like callInTx(Callable) but does not require Exception handling (rethrows an Exception as a runtime
DaoException). |
|
|
delete(T entity)
Convenient call for AbstractDao.delete(Object). |
|
|
deleteAll(java.lang.Class<T> entityClass)
Convenient call for AbstractDao.deleteAll(). |
|
AbstractDao<?,?> |
getDao(java.lang.Class<? extends java.lang.Object> entityClass)
|
|
SQLiteDatabase |
getDatabase()
Gets the SQLiteDatabase for custom database access. |
|
|
insert(T entity)
Convenient call for AbstractDao.insert(Object). |
|
|
insertOrReplace(T entity)
Convenient call for AbstractDao.insertOrReplace(Object). |
|
|
load(java.lang.Class<T> entityClass,
K key)
Convenient call for AbstractDao.load(Object). |
|
|
loadAll(java.lang.Class<T> entityClass)
Convenient call for AbstractDao.loadAll(). |
|
|
queryBuilder(java.lang.Class<T> entityClass)
Convenient call for AbstractDao.queryBuilder(). |
|
|
queryRaw(java.lang.Class<T> entityClass,
java.lang.String where,
java.lang.String... selectionArgs)
Convenient call for AbstractDao.queryRaw(String, String...). |
|
|
refresh(T entity)
Convenient call for AbstractDao.refresh(Object). |
|
void |
runInTx(java.lang.Runnable runnable)
Run the given Runnable inside a database transaction. |
|
|
update(T entity)
Convenient call for AbstractDao.update(Object). |
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractDaoSession(SQLiteDatabase db)
| Method Detail |
|---|
public <T> long insert(T entity)
AbstractDao.insert(Object).
public <T> long insertOrReplace(T entity)
AbstractDao.insertOrReplace(Object).
public <T> void refresh(T entity)
AbstractDao.refresh(Object).
public <T> void update(T entity)
AbstractDao.update(Object).
public <T> void delete(T entity)
AbstractDao.delete(Object).
public <T> void deleteAll(java.lang.Class<T> entityClass)
AbstractDao.deleteAll().
public <T,K> T load(java.lang.Class<T> entityClass,
K key)
AbstractDao.load(Object).
public <T,K> java.util.List<T> loadAll(java.lang.Class<T> entityClass)
AbstractDao.loadAll().
public <T,K> java.util.List<T> queryRaw(java.lang.Class<T> entityClass,
java.lang.String where,
java.lang.String... selectionArgs)
AbstractDao.queryRaw(String, String...).
public <T> QueryBuilder<T> queryBuilder(java.lang.Class<T> entityClass)
AbstractDao.queryBuilder().
public AbstractDao<?,?> getDao(java.lang.Class<? extends java.lang.Object> entityClass)
public void runInTx(java.lang.Runnable runnable)
public <V> V callInTx(java.util.concurrent.Callable<V> callable)
throws java.lang.Exception
java.lang.Exceptionpublic <V> V callInTxNoException(java.util.concurrent.Callable<V> callable)
callInTx(Callable) but does not require Exception handling (rethrows an Exception as a runtime
DaoException).
public SQLiteDatabase getDatabase()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||