deltaspike-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gerhard Petracek <>
Subject Re: How-to initialize the transactional context ?
Date Wed, 16 Dec 2015 17:24:27 GMT
hi pierre,

you need a cdi-bean which is annotated with
@org.apache.deltaspike.jpa.api.transaction.Transactional (or all public
methods of the bean which need to be transactional).
if you annotate the whole class, all public methods of that bean are
the outermost transactional method also starts (and stops) the
transaction-context and you can access @TransactionScope beans (also see
e.g. [1] and [2]).



2015-12-16 16:35 GMT+01:00 Pierre De Swert <>:

> Hi everybody,
> I am adapting an application based on Tapestry, EJBs and Hibernate. The
> idea is to convert a subset the stateless session beans into CDI managed
> beans in order to supply a CDI based component that could be used in both a
> java SE and Java EE environment.  Unfortunately I fail to set a
> transactional context for the entity managers that I inject in my CDI
> managed beans. I am stuck. Maybe the solution if obvious for all of you…
> I need to know the right scope I have to specify for the entity manager
> producers.
> @TransactionScope => The first access to the application gives a
> org.jboss.weld.context.ContextNotActiveException: WELD-001303 No active
> contexts for scope type
> org.apache.deltaspike.jpa.api.transaction.TransactionScoped
> @RequestScope => An attempt to persist an update gives a
> javax.persistence.TransactionRequiredException: no transaction is in
> progress javax.persistence.TransactionRequiredException: JBAS011469
> I have got a JTA datasource. Which transaction strategy do I have to
> specify  in the beans.xml? BeanManagedUserTransactionStrategy?
> ContainerManagedTransactionStrategy?
> Many thanks for your help.
> Pierre

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message