de.greenrobot.dao
Class AbstractDaoSession
java.lang.Object
de.greenrobot.dao.AbstractDaoSession
-
public class AbstractDaoSession
- extends java.lang.Object
-
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.
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractDaoSession
public AbstractDaoSession(SQLiteDatabase db)
insert
public long insert(T entity)
-
Convenient call for
AbstractDao.insert(Object)
.
-
insertOrReplace
public long insertOrReplace(T entity)
-
Convenient call for
AbstractDao.insertOrReplace(Object)
.
-
refresh
public void refresh(T entity)
-
Convenient call for
AbstractDao.refresh(Object)
.
-
update
public void update(T entity)
-
Convenient call for
AbstractDao.update(Object)
.
-
delete
public void delete(T entity)
-
Convenient call for
AbstractDao.delete(Object)
.
-
deleteAll
public void deleteAll(java.lang.Class entityClass)
-
Convenient call for
AbstractDao.deleteAll()
.
-
load
public T load(java.lang.Class entityClass,
K key)
-
Convenient call for
AbstractDao.load(Object)
.
-
loadAll
public java.util.List loadAll(java.lang.Class entityClass)
-
Convenient call for
AbstractDao.loadAll()
.
-
queryRaw
public java.util.List queryRaw(java.lang.Class entityClass,
java.lang.String where,
java.lang.String... selectionArgs)
-
Convenient call for
AbstractDao.queryRaw(String, String...)
.
-
queryBuilder
public QueryBuilder queryBuilder(java.lang.Class entityClass)
-
Convenient call for
AbstractDao.queryBuilder()
.
-
getDao
public AbstractDao,?> getDao(java.lang.Class extends java.lang.Object> entityClass)
-
runInTx
public void runInTx(java.lang.Runnable runnable)
-
Run the given Runnable inside a database transaction. If you except a result, consider callInTx.
-
callInTx
public V callInTx(java.util.concurrent.Callable callable)
throws java.lang.Exception
-
Calls the given Callable inside a database transaction and returns the result of the Callable. If you don't except a result, consider runInTx.
-
- Throws:
java.lang.Exception
Copyright © 2011-2012 greenrobot.de. All Rights Reserved.