|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
@PersistenceContext
)
@Deprecated public interface JpaCallback<T>
Callback interface for JPA code. To be used with JpaTemplate
's
execution method, often as anonymous classes within a method implementation.
A typical implementation will call EntityManager.find/merge
to perform some operations on persistent objects.
JpaTemplate
,
JpaTransactionManager
Method Summary | |
---|---|
T |
doInJpa(EntityManager em)
Deprecated. Gets called by JpaTemplate.execute with an active
JPA EntityManager . |
Method Detail |
---|
T doInJpa(EntityManager em) throws PersistenceException
JpaTemplate.execute
with an active
JPA EntityManager
. Does not need to care about activating
or closing the EntityManager
, or handling transactions.
Note that JPA callback code will not flush any modifications to the database if not executed within a transaction. Thus, you need to make sure that JpaTransactionManager has initiated a JPA transaction when the callback gets called, at least if you want to write to the database.
Allows for returning a result object created within the callback, i.e. a domain object or a collection of domain objects. A thrown custom RuntimeException is treated as an application exception: It gets propagated to the caller of the template.
em
- active EntityManager
null
if none
PersistenceException
- if thrown by the JPA APIJpaTemplate.execute(org.springframework.orm.jpa.JpaCallback)
,
JpaTemplate.executeFind(org.springframework.orm.jpa.JpaCallback>)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |