E - entity classK - primary key classpublic class CrudDAO<E,K> extends Object
| Constructor and Description |
|---|
CrudDAO(Class<E> entityClass)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
create(E entity)
Creates entity.
|
List<E> |
findAll()
Retrieves all entities.
|
E |
findByPK(K pk)
Retrieves entity by primary key.
|
Long |
findMaxId(String idColName)
Retrieves the maximum ID from the entities.
|
E |
merge(E entity)
Updates entity.
|
void |
refresh(E entity)
Refreshes entity.
|
void |
remove(Collection<E> entities)
Deletes entities.
|
void |
remove(E entity)
Deletes entity.
|
void |
removeByPK(K pk)
Deletes entity by PK.
|
public E findByPK(K pk)
pk - primary keypublic Long findMaxId(String idColName)
idColName - name of the column that corresponds to the ID.protected void create(E entity)
entity - entity to createpublic E merge(E entity)
entity - entity to updatepublic void refresh(E entity)
entity - entity to refreshpublic void remove(E entity)
entity - entity to deletepublic void remove(Collection<E> entities)
entities - entities to deletepublic void removeByPK(K pk)
pk - primary keyCopyright © 2022 Apache Software Foundation. All rights reserved.