deltaspike-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Esteve Avilés <eavil...@gmail.com>
Subject Re: @Transactional annotiation support
Date Thu, 13 Nov 2014 15:17:18 GMT
Gerhard,

Thanks for the reply. I don't understand from your reply and documentation
if I would be able to achieve what I told you in this particular
environment.

Thanks in advance.

Esteve

On Thu, Nov 13, 2014 at 9:26 AM, Gerhard Petracek <
gerhard.petracek@gmail.com> wrote:

> hi esteve,
>
> if you have one persistence-unit, the interceptor-logic executed for the
> outermost transactional method will #begin and finally #commit/#rollback
> the transaction for the UserTransaction provided by the container (see
> BeanManagedUserTransactionStrategy).
>
> regards,
> gerhard
>
> http://www.irian.at
>
> Your JavaEE powerhouse -
> JavaEE Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache
> MyFaces, DeltaSpike and OpenWebBeans
>
>
>
> 2014-11-12 22:17 GMT+01:00 Esteve Avilés <eavilesa@gmail.com>:
>
> > Hi all,
> >
> > I am using Deltaspike 1.0.3 in a JBoss EAP 6.3 server. We want to use
> > @Transactional annotation to delimiter a transactions. We use JTA and we
> > have set the beans alternative and created extended entity manager.
> >
> > After setting @Transactional as follows (we first call
> > createAllValsForAPromocioValDescompte):
> > /**
> >  * Facade method for createAllValsForAPromocioValDescompte.
> >  * It first gets the PromocioValDescompte by its Id and then calls
> > createAllValsForAPromocioValDescompte
> >  * @param promocioValDescompteId
> >  * @throws BusinessException
> >  */
> > public void createAllValsForAPromocioValDescompte(Long
> > promocioValDescompteId) throws BusinessException {
> > PromocioValDescompte promocio = retrieveById(promocioValDescompteId);
> > if(promocio != null) {
> > updateStatusToInProgress(promocio);
> > this.createAllValsForAPromocioValDescompte(promocio);
> > } else {
> > log.error("PromocioValDescompte no trobat amb Id {} per proces creacio
> > vals", promocioValDescompteId);
> > }
> > }
> >  @Transactional(readOnly = false)
> > public void updateStatusToInProgress(PromocioValDescompte
> > promocioValDescompte) throws BusinessException {
> >
> >
> promocioValDescompte.setEstatProcesGeneracio(EstatPromocioValDescompte.EN_EXECUCIO);
> > promocioValDescompteRepository.saveAndFlush(promocioValDescompte);
> > }
> >  /**
> >  * Generates all vouchers that will be contained in the
> > EmissioVoucherPredefinit
> >  * @param promocioValDescompte
> >  * @param emissorVoucher
> >  * @param tipusVoucher
> >  * @throws BusinessException
> >  */
> > @Transactional
> > public void createAllValsForAPromocioValDescompte(PromocioValDescompte
> > promocioValDescompte) throws BusinessException {
> >
> > log.info("Inici creacio de {} vals per a l'emissio {} i Id {}",
> > promocioValDescompte.getQuantitatDemanada(),
> promocioValDescompte.getNom(),
> > promocioValDescompte.getId());
> > promocioValDescompte.setQuantitatGenerada(0);
> > .....
> >
> > We see all methods executed in a unique transaction, and database is only
> > updated at the end.
> >
> > Do we need to set something else? Before that, in a JEE5 env, we were
> > using @Transactional(TransactionPropagationType.REQUIRED)
> > and @Transactional(TransactionPropagationType.NEVER) to achieve the same
> > objective.
> >
> > Can anyone help us?
> >
> > Thanks in advance.
> >
> > Regards,
> >
> > --
> > Esteve Avilés
> >
>



-- 
Esteve Avilés

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