Package fr.paris.lutece.util.jpa
Class JPAGenericDAO<K,E>
java.lang.Object
fr.paris.lutece.util.jpa.JPAGenericDAO<K,E>
- Type Parameters:
K- Type of the entity's keyE- Type of the entity
- All Implemented Interfaces:
IGenericDAO<K,E>
- Direct Known Subclasses:
JPALuteceDAO
Class JPAGenericDAO
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCreate an entityvoidRemove the given entity from the persistence context, causing a managed entity to become detached.findAll()Find all entitiesFind an entity by its Idvoidflush()Synchronize the persistence context to the underlying database.javax.persistence.EntityManagergetEM()Return the Entity ManagerGets the entity classReturns the entity class nameabstract javax.persistence.EntityManagerFactoryInherit classes should provide their Entity Manager FactoryvoidRemove an entityvoidUpdate an entity
-
Constructor Details
-
JPAGenericDAO
public JPAGenericDAO()Constructor
-
-
Method Details
-
getEntityManagerFactory
public abstract javax.persistence.EntityManagerFactory getEntityManagerFactory()Inherit classes should provide their Entity Manager Factory- Returns:
- The Entity Manager Factory that will create Entity Manager for this DAO
-
getEntityClassName
Returns the entity class name- Returns:
- The entity class name
-
getEntityClass
Gets the entity class- Returns:
- the entity class
-
getEM
public javax.persistence.EntityManager getEM()Return the Entity Manager- Returns:
- The Entity Manager
-
create
Create an entity- Specified by:
createin interfaceIGenericDAO<K,E> - Parameters:
entity- The entity to create
-
remove
Remove an entity- Specified by:
removein interfaceIGenericDAO<K,E> - Parameters:
key- The key of the entity to remove
-
update
Update an entity- Specified by:
updatein interfaceIGenericDAO<K,E> - Parameters:
entity- An entity that contains new values
-
findById
Find an entity by its Id- Specified by:
findByIdin interfaceIGenericDAO<K,E> - Parameters:
key- The entity key- Returns:
- The entity object
-
findAll
Find all entities- Specified by:
findAllin interfaceIGenericDAO<K,E> - Returns:
- A list of entities
-
flush
public void flush()Synchronize the persistence context to the underlying database.- Specified by:
flushin interfaceIGenericDAO<K,E>
-
detach
Remove the given entity from the persistence context, causing a managed entity to become detached.- Specified by:
detachin interfaceIGenericDAO<K,E> - Parameters:
entity- the entity
-