Interface GenericDAO<E,ID extends Serializable>
- Type Parameters:
E- Entity typeID- Identity of the entity
public interface GenericDAO<E,ID extends Serializable>
- Version:
- $Revision$
- Author:
- Trong Tran
-
Method Summary
Modifier and TypeMethodDescriptioncount()Get the number of entities with the specified type and id from the datasource.Insert a new entity.voidInsert a list of new entities in the persistence context.voidDelete the specified entity from the persistence context.voidRemove all of the entities from the persistence context.voidRemove all of the specified entities from the persistence context.Return an entity which is associated with specified id.findAll()Get a list of all object of the specified type from the datasource.Update the entity in the persistence context.voidUpdate the entity in the persistence context.
-
Method Details
-
count
Long count()Get the number of entities with the specified type and id from the datasource.- Returns:
- the entity, null if none is found
-
find
Return an entity which is associated with specified id.- Returns:
- an entity. Otherwise, return NULL.
-
findAll
Get a list of all object of the specified type from the datasource.- Returns:
- a list of entities
-
create
Insert a new entity. If the entity already exist, use update(E entity) instead- Returns:
- the new entity
-
createAll
Insert a list of new entities in the persistence context. If the entities already exist, use update(E entity) instead -
update
Update the entity in the persistence context. If the entity does not already exist, use create(E entity) instead- Returns:
- the just created entity
-
updateAll
Update the entity in the persistence context. If the entity does not already exist, use create(E entity) instead -
delete
Delete the specified entity from the persistence context. -
deleteAll
Remove all of the specified entities from the persistence context. -
deleteAll
void deleteAll()Remove all of the entities from the persistence context.
-