|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
K - The primary key class of the entity, e.g. Long.E - The entity class the DAO persists, e.g. Person.public interface Dao<K,E>
Base interface for all DAOs. To use, extend it in DAO interfaces.
| Method Summary | |
|---|---|
void |
clear()
Clear the in-memory persistable state, including unflushed changes. |
boolean |
contains(E entity)
Check if the entity belongs to the current persistence context. |
Long |
countAll()
Count all values represented by the entity class this DAO persists (no where clause, no path expression). |
Long |
countAll(String where)
Count all values represented by the specified where clause for the entity class this DAO persists. |
Long |
countAll(String where,
String pathExpression)
Count all values represented by the specified where clause and pathExpression for the entity class this DAO persists. |
List<E> |
findAll()
Find all entities. |
List<E> |
findAll(int startPosition,
int maxResult)
Find all entities starting in the resultset specified by startPosition and obtaining up to the number specified by maxResult. |
E |
findById(K id)
Find an entity by its id, and return null if not found. |
void |
flush()
Synchronize the underlying persistent store with persistable state held in memory. |
E |
merge(E entity)
Merge the entity. |
void |
persist(Collection<E> entities)
Save the Collection of entities. |
void |
persist(E entity)
Save the entity. |
void |
refresh(E entity)
Reload the entity. |
void |
remove(E entity)
Delete the entity. |
| Method Detail |
|---|
void persist(E entity)
entity - The persistence entity to save.void persist(Collection<E> entities)
entities - The Collection of persistence entities to save.E merge(E entity)
entity - The persistence entity to merge.
void remove(E entity)
entity - The persistence entity to delete.E findById(K id)
id - The id (primary key) of the entity to find.
List<E> findAll()
List<E> findAll(int startPosition,
int maxResult)
startPosition - The starting position in the result set to retrieve.maxResult - The maximum number of rows to retrieve.
void flush()
void clear()
boolean contains(E entity)
entity - The persistence entity to see if exists.
void refresh(E entity)
entity - The persistence entity to reload from the persistence context.Long countAll()
Long countAll(String where)
This convenience method is meant for simple count queries. For complex ones, create custom ones in the product DAOs.
where - See where param for #countAll(String, String)
Long countAll(String where,
String pathExpression)
This convenience method is meant for simple count queries. For complex ones, create custom ones in the product DAOs.
where - The where clause to append to the count query to narrow the
counted values. Do not prefix with "where" as it is
automatically added. The underlying query uses "e" as the
identification variable, so the where will use "e", e.g.
"e.name = 'Fred'". Specifying null disregards a where clause.pathExpression - A String representing the object graph navigation to the
element to count. The underlying query uses "e" as the
identification variable, so the pathExpression will u "e",
e.g. "e.address.zip", "e.name", "e.id". Specify either an
identification variable (e.g. "e") or a path expression (e.g.
"e.address.zip"). Specifying null disregards a pathExpression
(defaults to "*").
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||