You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@deltaspike.apache.org by Juliano Marques <ju...@gmail.com> on 2014/08/14 09:24:53 UTC
Deltaspike Data Module
Hi,
I want to use Deltaspike Data Module repositories, but I want to control
transactions with EJBs, not within the repository, something like this:
@Dependent
@Repository
public interface UnidadeRepository2 extends EntityRepository<Unidade, Long>
{
}
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public class UnidadeEJB {
@Inject
private UnidadeRepository2 repository;
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public Unidade save(Unidade unidade) {
return repository.saveAndFlush(unidade);
}
}
Is this possible?
Regards,
*Juliano M.*
Re: Deltaspike Data Module
Posted by Rafael Benevides <be...@redhat.com>.
I'm glad that it worked :)
Abraços
Em 8/14/14, 9:04, Juliano Marques escreveu:
> With Wildfly 8, the alternative in beans.xml do not work, but the global
> alternative in apache-deltaspike.properties works.
> I had a problem with Deltaspike repositories and JTA datasources, and this
> resolves the problem.
> Thanks.
>
> Atenciosamente,
>
> *Juliano M.*
>
>
>
> On Thu, Aug 14, 2014 at 8:15 AM, Rafael Benevides <be...@redhat.com>
> wrote:
>
>> Yes. It's possible.
>>
>> Depending on your implementation, You may need to register the
>> `org.apache.deltaspike.jpa.impl.transaction.ContainerManagedTransactionStrategy`
>> as an alternative on your beans.xml
>>
>> or registered as globalAlternatives.org.apache.deltaspike.jpa.spi.
>> transaction.TransactionStrategy=org.apache.deltaspike.jpa.impl.
>> transaction.ContainerManagedTransactionStrategy on your
>> apache-deltaspike.properties if it doesn't work out of the box.
>>
>> Em 8/14/14, 4:24, Juliano Marques escreveu:
>>
>>> Hi,
>>>
>>> I want to use Deltaspike Data Module repositories, but I want to control
>>> transactions with EJBs, not within the repository, something like this:
>>>
>>> @Dependent
>>> @Repository
>>> public interface UnidadeRepository2 extends EntityRepository<Unidade,
>>> Long>
>>> {
>>> }
>>>
>>> @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
>>> public class UnidadeEJB {
>>>
>>> @Inject
>>> private UnidadeRepository2 repository;
>>>
>>> @TransactionAttribute(TransactionAttributeType.REQUIRED)
>>> public Unidade save(Unidade unidade) {
>>> return repository.saveAndFlush(unidade);
>>> }
>>> }
>>>
>>> Is this possible?
>>>
>>>
>>> Regards,
>>>
>>> *Juliano M.*
>>>
>>>
Re: Deltaspike Data Module
Posted by Juliano Marques <ju...@gmail.com>.
With Wildfly 8, the alternative in beans.xml do not work, but the global
alternative in apache-deltaspike.properties works.
I had a problem with Deltaspike repositories and JTA datasources, and this
resolves the problem.
Thanks.
Atenciosamente,
*Juliano M.*
On Thu, Aug 14, 2014 at 8:15 AM, Rafael Benevides <be...@redhat.com>
wrote:
> Yes. It's possible.
>
> Depending on your implementation, You may need to register the
> `org.apache.deltaspike.jpa.impl.transaction.ContainerManagedTransactionStrategy`
> as an alternative on your beans.xml
>
> or registered as globalAlternatives.org.apache.deltaspike.jpa.spi.
> transaction.TransactionStrategy=org.apache.deltaspike.jpa.impl.
> transaction.ContainerManagedTransactionStrategy on your
> apache-deltaspike.properties if it doesn't work out of the box.
>
> Em 8/14/14, 4:24, Juliano Marques escreveu:
>
>> Hi,
>>
>> I want to use Deltaspike Data Module repositories, but I want to control
>> transactions with EJBs, not within the repository, something like this:
>>
>> @Dependent
>> @Repository
>> public interface UnidadeRepository2 extends EntityRepository<Unidade,
>> Long>
>> {
>> }
>>
>> @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
>> public class UnidadeEJB {
>>
>> @Inject
>> private UnidadeRepository2 repository;
>>
>> @TransactionAttribute(TransactionAttributeType.REQUIRED)
>> public Unidade save(Unidade unidade) {
>> return repository.saveAndFlush(unidade);
>> }
>> }
>>
>> Is this possible?
>>
>>
>> Regards,
>>
>> *Juliano M.*
>>
>>
>
Re: Deltaspike Data Module
Posted by Rafael Benevides <be...@redhat.com>.
Yes. It's possible.
Depending on your implementation, You may need to register the
`org.apache.deltaspike.jpa.impl.transaction.ContainerManagedTransactionStrategy`
as an alternative on your beans.xml
or registered as
globalAlternatives.org.apache.deltaspike.jpa.spi.transaction.TransactionStrategy=org.apache.deltaspike.jpa.impl.transaction.ContainerManagedTransactionStrategy
on your apache-deltaspike.properties if it doesn't work out of the box.
Em 8/14/14, 4:24, Juliano Marques escreveu:
> Hi,
>
> I want to use Deltaspike Data Module repositories, but I want to control
> transactions with EJBs, not within the repository, something like this:
>
> @Dependent
> @Repository
> public interface UnidadeRepository2 extends EntityRepository<Unidade, Long>
> {
> }
>
> @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
> public class UnidadeEJB {
>
> @Inject
> private UnidadeRepository2 repository;
>
> @TransactionAttribute(TransactionAttributeType.REQUIRED)
> public Unidade save(Unidade unidade) {
> return repository.saveAndFlush(unidade);
> }
> }
>
> Is this possible?
>
>
> Regards,
>
> *Juliano M.*
>