|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectch.elca.el4j.services.persistence.jpa.helper.JpaHelperImpl
public class JpaHelperImpl
Implementation of DataService.
| Constructor Summary | |
|---|---|
JpaHelperImpl()
|
|
| Method Summary | ||
|---|---|---|
void |
clear()
Clear the session. |
|
|
contains(T instance)
Contains an entry. |
|
|
detach(T instance)
Remove the given entity from the persistence context, causing a managed entity to become detached. |
|
void |
doInTransaction(Runnable r)
|
|
|
findByKey(Class<T> clazz,
Integer key)
Finds an entity by its primary key. |
|
void |
flush()
Flush the session. |
|
javax.persistence.EntityManager |
getEntityManager()
Getter for entity manager. |
|
|
merge(T instance)
Merge the state of the given entity into the current persistence context. |
|
|
persist(T instance)
Makes an entity managed and persistent. |
|
|
refresh(T instance)
Refresh the state of the instance from the database, overwriting changes made to the entity, if any. |
|
|
remove(T instance)
Delete a MANAGED entity. |
|
|
selectFrom(Class<T> cls)
Initiate a select query. |
|
void |
setEntityManager(javax.persistence.EntityManager em)
Set the entity manager. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JpaHelperImpl()
| Method Detail |
|---|
public <T> JpaQuery<T> selectFrom(Class<T> cls)
JpaHelper
selectFrom in interface JpaHelperT - Generic type parameter for the class to select from.cls - The class to select from.
@Transactional public <T> Boolean contains(T instance)
JpaHelper
contains in interface JpaHelperT - The type parameter.instance - The object to check if the entity manager contains it.
@Transactional public <T> T merge(T instance)
JpaHelperDETACHED to MANAGED.
merge in interface JpaHelperT - The type parameter, to allow us to return the merged object.instance - The object to merge.
@Transactional public <T> void detach(T instance)
JpaHelperMANAGED to DETACHED.
detach in interface JpaHelperT - The type parameter.instance - The object to detach.@Transactional public <T> void persist(T instance)
JpaHelperNEW/REMOVED
to MANAGED.
On the next flush or commit it is inserted into the database.
persist in interface JpaHelperT - The type parameter.instance - The object to persist.@Transactional public <T> void remove(T instance)
JpaHelperMANAGED entity. Transition from state MANAGED to REMOVED.
On the next flush or commit it is removed from the database.
remove in interface JpaHelperT - The type parameter.instance - The instance to delete.@Transactional public <T> void refresh(T instance)
JpaHelperMANAGED to MANAGED again.
refresh in interface JpaHelperT - The type parameter.instance - The instance to refresh.
@Transactional
public <T> T findByKey(Class<T> clazz,
Integer key)
JpaHelperMANAGED.
findByKey in interface JpaHelperT - The type parameter, to allow us to return the searched object.clazz - The entity class.key - The primary key.
MANAGED).public void clear()
JpaHelper
clear in interface JpaHelper@Transactional public void flush()
JpaHelper
flush in interface JpaHelperpublic javax.persistence.EntityManager getEntityManager()
public void setEntityManager(javax.persistence.EntityManager em)
em - The entity manager.@Transactional public void doInTransaction(Runnable r)
doInTransaction in interface JpaHelper
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||