|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.greenrobot.dao.AbstractDao<T,K>
T
- Entity typeK
- Primary key (PK) type; use Void if entity does not have exactly one PKpublic abstract class AbstractDao<T,K>
Base class for all DAOs: Implements entity operations like insert, load, delete, and query. This class is thread-safe.
Constructor Summary | |
---|---|
AbstractDao(DaoConfig config)
|
|
AbstractDao(DaoConfig config,
AbstractDaoSession daoSession)
|
Method Summary | |
---|---|
long |
count()
|
void |
delete(T entity)
Deletes the given entity from the database. |
void |
deleteAll()
|
void |
deleteByKey(K key)
Deletes an entity with the given PK from the database. |
void |
deleteInTx(java.lang.Iterable<T> entities)
Deletes the given entities in the database using a transaction. |
void |
deleteInTx(T... entities)
Deletes the given entities in the database using a transaction. |
boolean |
detach(T entity)
Detaches an entity from the identity scope (session). |
java.lang.String[] |
getAllColumns()
|
SQLiteDatabase |
getDatabase()
Gets the SQLiteDatabase for custom database access. |
java.lang.String[] |
getNonPkColumns()
|
java.lang.String[] |
getPkColumns()
|
Property |
getPkProperty()
|
Property[] |
getProperties()
|
AbstractDaoSession |
getSession()
|
java.lang.String |
getTablename()
|
long |
insert(T entity)
Insert an entity into the table associated with a concrete DAO. |
void |
insertInTx(java.lang.Iterable<T> entities)
Inserts the given entities in the database using a transaction. |
void |
insertInTx(java.lang.Iterable<T> entities,
boolean setPrimaryKey)
Inserts the given entities in the database using a transaction. |
void |
insertInTx(T... entities)
Inserts the given entities in the database using a transaction. |
long |
insertOrReplace(T entity)
Insert an entity into the table associated with a concrete DAO. |
void |
insertOrReplaceInTx(java.lang.Iterable<T> entities)
Inserts or replaces the given entities in the database using a transaction. |
void |
insertOrReplaceInTx(java.lang.Iterable<T> entities,
boolean setPrimaryKey)
Inserts or replaces the given entities in the database using a transaction. |
void |
insertOrReplaceInTx(T... entities)
Inserts or replaces the given entities in the database using a transaction. |
long |
insertWithoutSettingPk(T entity)
Insert an entity into the table associated with a concrete DAO without setting key property. |
T |
load(K key)
Loads and entity for the given PK. |
java.util.List<T> |
loadAll()
Loads all available entities from the database. |
T |
loadByRowId(long rowId)
|
java.util.List<T> |
query(java.lang.String selection,
java.lang.String[] selectionArgs,
java.lang.String groupBy,
java.lang.String having,
java.lang.String orderby)
Deprecated. groupBy & having does not make sense for entities. Method will be removed. |
QueryBuilder<T> |
queryBuilder()
|
java.util.List<T> |
queryRaw(java.lang.String where,
java.lang.String... selectionArg)
A raw-style query where you can pass any WHERE clause and arguments. |
void |
refresh(T entity)
Resets all locally changed properties of the entity by reloading the values from the database. |
void |
update(T entity)
|
void |
updateInTx(java.lang.Iterable<T> entities)
Updates the given entities in the database using a transaction. |
void |
updateInTx(T... entities)
Updates the given entities in the database using a transaction. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractDao(DaoConfig config)
public AbstractDao(DaoConfig config, AbstractDaoSession daoSession)
Method Detail |
---|
public AbstractDaoSession getSession()
public java.lang.String getTablename()
public Property[] getProperties()
public Property getPkProperty()
public java.lang.String[] getAllColumns()
public java.lang.String[] getPkColumns()
public java.lang.String[] getNonPkColumns()
public T load(K key)
key
- a PK value or null
public T loadByRowId(long rowId)
public java.util.List<T> loadAll()
public boolean detach(T entity)
public void insertInTx(java.lang.Iterable<T> entities)
entities
- The entities to insert.public void insertInTx(T... entities)
entities
- The entities to insert.public void insertInTx(java.lang.Iterable<T> entities, boolean setPrimaryKey)
entities
- The entities to insert.setPrimaryKey
- if true, the PKs of the given will be set after the insert; pass false to improve performance.public void insertOrReplaceInTx(java.lang.Iterable<T> entities, boolean setPrimaryKey)
entities
- The entities to insert.setPrimaryKey
- if true, the PKs of the given will be set after the insert; pass false to improve performance.public void insertOrReplaceInTx(java.lang.Iterable<T> entities)
entities
- The entities to insert.public void insertOrReplaceInTx(T... entities)
entities
- The entities to insert.public long insert(T entity)
public long insertWithoutSettingPk(T entity)
public long insertOrReplace(T entity)
public java.util.List<T> queryRaw(java.lang.String where, java.lang.String... selectionArg)
public java.util.List<T> query(java.lang.String selection, java.lang.String[] selectionArgs, java.lang.String groupBy, java.lang.String having, java.lang.String orderby)
public void deleteAll()
public void delete(T entity)
public void deleteByKey(K key)
public void deleteInTx(java.lang.Iterable<T> entities)
entities
- The entities to delete.public void deleteInTx(T... entities)
entities
- The entities to delete.public void refresh(T entity)
public void update(T entity)
public QueryBuilder<T> queryBuilder()
public void updateInTx(java.lang.Iterable<T> entities)
entities
- The entities to insert.public void updateInTx(T... entities)
entities
- The entities to update.public long count()
public SQLiteDatabase getDatabase()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |