You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltaspike.apache.org by akm <am...@ford.com> on 2015/07/13 23:23:49 UTC

@TransactionScoped Entity Manager does not support a readonly hint

Using a TransactionScoped EntityManager producer does not allow a read method
to have a read only hint.
I would like all the read operations to be use a readonly connection. 

But when I try it I get an error that there is no active scope.
Is it not possible to use readonly with a transaction scope EM?

 @Transactional(qualifier = myAppEntityManager.class, r*eadOnly = true*)
    public List<CertificationTypeDE> findAllCertificationType() {

        return this.certificationTypeRepository.findAll();

    }

*INFO: [failed] com.repository.TransactionTest#FindCertificationTypeTest
message: Exception calling Repository: [Repository=class
com.ford.it.sample.repository.CertificationTypeRepository$$DSPartialBeanProxy,method=findAll],exception=class
org.jboss.weld.context.ContextNotActiveException,message=WELD-001303: No
active contexts for scope type
org.apache.deltaspike.jpa.api.transaction.TransactionScoped*



--
View this message in context: http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/TransactionScoped-Entity-Manager-does-not-support-a-readonly-hint-tp4661057.html
Sent from the Apache DeltaSpike Incubator Discussions mailing list archive at Nabble.com.

Re: @TransactionScoped Entity Manager does not support a readonly hint

Posted by Gerhard Petracek <ge...@gmail.com>.
hi,

please ensure that the read-only hint is on the outermost transactional
method.
-> you should see that ResourceLocalTransactionStrategy#isRollbackOnly
returns true.

regards,
gerhard



2015-07-13 23:23 GMT+02:00 akm <am...@ford.com>:

> Using a TransactionScoped EntityManager producer does not allow a read
> method
> to have a read only hint.
> I would like all the read operations to be use a readonly connection.
>
> But when I try it I get an error that there is no active scope.
> Is it not possible to use readonly with a transaction scope EM?
>
>  @Transactional(qualifier = myAppEntityManager.class, r*eadOnly = true*)
>     public List<CertificationTypeDE> findAllCertificationType() {
>
>         return this.certificationTypeRepository.findAll();
>
>     }
>
> *INFO: [failed] com.repository.TransactionTest#FindCertificationTypeTest
> message: Exception calling Repository: [Repository=class
>
> com.ford.it.sample.repository.CertificationTypeRepository$$DSPartialBeanProxy,method=findAll],exception=class
> org.jboss.weld.context.ContextNotActiveException,message=WELD-001303: No
> active contexts for scope type
> org.apache.deltaspike.jpa.api.transaction.TransactionScoped*
>
>
>
> --
> View this message in context:
> http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/TransactionScoped-Entity-Manager-does-not-support-a-readonly-hint-tp4661057.html
> Sent from the Apache DeltaSpike Incubator Discussions mailing list archive
> at Nabble.com.
>