K
- Type of the entity's keyE
- Type of the entitypublic abstract class JPAGenericDAO<K,E> extends Object implements IGenericDAO<K,E>
Constructor and Description |
---|
JPAGenericDAO()
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
create(E entity)
Create an entity
|
void |
detach(E entity)
Remove the given entity from the persistence context, causing a managed entity to become detached.
|
List<E> |
findAll()
Find all entities
|
E |
findById(K key)
Find an entity by its Id
|
void |
flush()
Synchronize the persistence context to the underlying database.
|
javax.persistence.EntityManager |
getEM()
Return the Entity Manager
|
Class<E> |
getEntityClass()
Gets the entity class
|
String |
getEntityClassName()
Returns the entity class name
|
abstract javax.persistence.EntityManagerFactory |
getEntityManagerFactory()
Inherit classes should provide their Entity Manager Factory
|
void |
remove(K key)
Remove an entity
|
void |
update(E entity)
Update an entity
|
public abstract javax.persistence.EntityManagerFactory getEntityManagerFactory()
public String getEntityClassName()
public javax.persistence.EntityManager getEM()
public void create(E entity)
create
in interface IGenericDAO<K,E>
entity
- The entity to createpublic void remove(K key)
remove
in interface IGenericDAO<K,E>
key
- The key of the entity to removepublic void update(E entity)
update
in interface IGenericDAO<K,E>
entity
- An entity that contains new valuespublic E findById(K key)
findById
in interface IGenericDAO<K,E>
key
- The entity keypublic List<E> findAll()
findAll
in interface IGenericDAO<K,E>
public void flush()
flush
in interface IGenericDAO<K,E>
public void detach(E entity)
detach
in interface IGenericDAO<K,E>
entity
- the entityCopyright © 2020 City of Paris. All rights reserved.