Hi Juliano
Yes that's unfortunately still a JTA portability issue on Wildfly. If you
want to use JTA, you can e.g. write a custom TransactionStrategy which
basically only proceeds with the invoke, and have an EJB control the
transaction.


On Fri, Jul 18, 2014 at 3:44 AM, Juliano Marques <[email protected]>
wrote:

> @Thomas
>
> In this example, I had to change transaction-type to RESOURCE_LOCAL, in
> persistence.xml.
>
> When the transaction-type is JTA in persistence.xml, the following
> exception is thrown:
> Caused by: java.lang.IllegalStateException: A JTA EntityManager cannot use
> getTransaction()
>
> This is right?
>
> Thanks a lot.
>
>
>
> Atenciosamente,
>
> *Juliano M.*
>
>
>
> On Thu, Jul 17, 2014 at 2:44 PM, Juliano Marques <
> [email protected]> wrote:
>
> > Hi Ian,
> >
> > I changed the transaction type to "RESOURCE_LOCAL" in persistence.xml.
> > The example works now.
> > Atenciosamente,
> >
> > Juliano Marques
> > Desenvolvimento Imobiliário
> > Criciúma - SC
> > Fone: (48) 3461-1000
> >
> >
> >
> >
> >
> > De:        Ian Darwin <[email protected]>
> > Para:        [email protected],
> > Data:        17/07/2014 14:27
> > Assunto:        Re: Null QueryInvocationContext in DS Data Module
> > ------------------------------
> >
> >
> >
> > On 2014-07-17, 9:29 AM, Juliano Marques wrote:
> > >
> > >
> > > De:     Thomas Hug <[email protected]>
> > > Para:   "[email protected]" <[email protected]>,
> > > Data:   17/07/2014 09:51
> > > Assunto:        RE: Null QueryInvocationContext in DS Data Module
> > >
> > >
> > >
> > > Hi Juliano
> > >
> > > Please inject a PersonRepository.
> > >
> > > EntityRepository<Person, Long> ends up in a different bean and is not
> > what
> > > you expect  - actually it’s an internal bean which is will be called
> > > underneath, but as it misses a bunch of initialization steps done by
> the
> > > Data extension you’ll get the NullPointerException.
> > >
> > > Hope that helps…
> > >
> > >
> > >
> > > [1] https://github.com/julianomqs/ds-data-module.git
> > >
> > >
> > Hola! When I tried your app, with the change Thomas suggested, I get
> this:
> >
> > 12:59:03,942 ERROR [io.undertow.request] (default task-5) UT005023:
> > Exception handling request to
> > /ds-data-module-test-1.0-SNAPSHOT/TestServlet:
> > org.apache.deltaspike.data.api.QueryInvocationException: Failed calling
> > Repository:
> >
> [Repository=ds.data.module.repository.PersonRepository,entity=ds.data.module.entity.Person,method=saveAndFlush,exception=class
> >
> > java.lang.IllegalStateException,message=A JTA EntityManager cannot use
> > getTransaction()
> >     at
> >
> org.apache.deltaspike.data.impl.handler.QueryHandler.invoke(QueryHandler.java:91)
> >
> > [deltaspike-data-module-impl-1.0.0.jar:1.0.0]
> >     at com.sun.proxy.$Proxy100.saveAndFlush(Unknown Source)
> >     at TestServlet.doGet(TestServlet.java:42)    at
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
> > [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
> >     at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
> > [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
> >
> > Do you have any uncommitted/unpushed changes to that github, or is there
> > something different in my environment?
> >
> > Gracias!
> >
> > Ian Darwin
> > [email protected]
> >
> >
> >
>

Reply via email to