deltaspike-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gerhard Petracek <gerhard.petra...@gmail.com>
Subject Re: How-to initialize the transactional context ?
Date Fri, 29 Jan 2016 19:19:24 GMT
short addition (fyi):
if someone faces the same issue, please have a look at [1].

regards,
gerhard

[1] https://issues.jboss.org/browse/WELD-2090

http://www.irian.at

Your JavaEE powerhouse -
JavaEE Consulting, Development and
Courses in English and German

Professional Support for Apache
MyFaces, DeltaSpike and OpenWebBeans



2015-12-16 18:24 GMT+01:00 Gerhard Petracek <gerhard.petracek@gmail.com>:

> 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
> transactional.
> the outermost transactional method also starts (and stops) the
> transaction-context and you can access @TransactionScope beans (also see
> e.g. [1] and [2]).
>
> regards,
> gerhard
>
> [1] http://deltaspike.apache.org/documentation/jpa.html#@TransactionScoped
> [2] http://deltaspike.apache.org/documentation/jpa.html#@Transactional
>
>
>
> 2015-12-16 16:35 GMT+01:00 Pierre De Swert <pierre.deswert@gmail.com>:
>
>> 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
>>
>
>

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