Wednesday, March 16, 2011

EntityManager must be access within a transaction

The error means of course
"EntityManager must be accessED within a transaction"

annotating your EJB method with:

(which is the default), ensures that
"If the client is not associated with a transaction, the container starts a new transaction before running the method."

(see here)
( see also discussion here)

Using the

you can annotate your method with
to make sure you join a brand new transaction

No comments: