You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltaspike.apache.org by hwaastad <he...@waastad.org> on 2014/10/28 09:40:06 UTC

ContainerManagedTransactionStrategy issue

Hi,
I need some help understanding how Deltaspike handles entitymanager lookup.
(I've made this post since the issue I've been struggeling with these last
couple og days actually are a result on how DS is handling CMT)

I've made a test project: https://github.com/hwaastad/DeltaDataTest.git
- JTA in persistence.xml
- CMT em producer
- ContainerManagedTransactionStrategy in beans.xml

This is a simple MDB persisting a dummy entity.

1. save(entity) will fail
2. findall() and the save(entity) is working.

Why is 1. failing?

br hw



--
View this message in context: http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/ContainerManagedTransactionStrategy-issue-tp4659285.html
Sent from the Apache DeltaSpike Incubator Discussions mailing list archive at Nabble.com.

Re: ContainerManagedTransactionStrategy issue

Posted by hwaastad <he...@waastad.org>.
Hi TH,
I know it'll work using PersistenceUnit but then again are'nt I using a
resource_local em?

I try to read the specs regarding JTA and somewhere I read: "You are not
allowed to use @PersistenceUnit to refer to a unit of type JTA"

I will happily help debugging this issue, but I'm a little bit over my head
when it comes to debugging DS code.

If you have any recommendations, I'll start digging further.

br hw



--
View this message in context: http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/ContainerManagedTransactionStrategy-issue-tp4659285p4659287.html
Sent from the Apache DeltaSpike Incubator Discussions mailing list archive at Nabble.com.

Re: ContainerManagedTransactionStrategy issue

Posted by hwaastad <he...@waastad.org>.
OK,
after going back to my ear project I still have an issue using repositories
and CMT.
(war is OK)

versions <1.0.3 is ok. 1.0.3 is not.

1. method expressions are working
2. @Query annotation is working
3. All abstract functions (find/save/findall etc etc) are not working

I have a simple ear project using tomee 1.7.1 plus. If needed, I can publish
it to github.

Can I file an issue in JIRA?

br hw



--
View this message in context: http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/ContainerManagedTransactionStrategy-issue-tp4659285p4659297.html
Sent from the Apache DeltaSpike Incubator Discussions mailing list archive at Nabble.com.

Re: ContainerManagedTransactionStrategy issue

Posted by hwaastad <he...@waastad.org>.
Hi TH,
Ok I've tried to be as explicit as I could:

https://issues.apache.org/jira/browse/DELTASPIKE-759

If anything else is needed, I'll do whatever I can. I do really want this to
be OK :-)

br hw



--
View this message in context: http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/ContainerManagedTransactionStrategy-issue-tp4659285p4659307.html
Sent from the Apache DeltaSpike Incubator Discussions mailing list archive at Nabble.com.

Re: ContainerManagedTransactionStrategy issue

Posted by Thomas Hug <th...@gmail.com>.
Yes please do so (JIRA and GitHub). Having it reproducible will make things
much easier.

On Wed, Oct 29, 2014 at 11:09 AM, hwaastad <he...@waastad.org> wrote:

> OK,
> after going back to my ear project I still have an issue using repositories
> and CMT.
> (war is OK)
>
> versions <1.0.3 is ok. 1.0.3 is not.
>
> 1. method expressions are working
> 2. @Query annotation is working
> 3. All abstract functions (find/save/findall etc etc) are not working
>
> I have a simple ear project using tomee 1.7.1 plus. If needed, I can
> publish
> it to github.
>
> Can I file an issue in JIRA?
>
> br hw
>
>
>
> --
> View this message in context:
> http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/ContainerManagedTransactionStrategy-issue-tp4659285p4659297.html
> Sent from the Apache DeltaSpike Incubator Discussions mailing list archive
> at Nabble.com.
>

Re: ContainerManagedTransactionStrategy issue

Posted by hwaastad <he...@waastad.org>.
OK guys,
after getting DS source and checking the test persistence being used for
openjpa, i noticed the option:

openejb.jpa.init-entitymanager

So, I figured out the equivalent for eclipselink:

eclipselink.deploy-on-startup

Now, the entitymanager producer works OK.

However, am I barking up the wrong tree here wanting it to work using
default persistence configuration?

br hw



--
View this message in context: http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/ContainerManagedTransactionStrategy-issue-tp4659285p4659293.html
Sent from the Apache DeltaSpike Incubator Discussions mailing list archive at Nabble.com.

Re: ContainerManagedTransactionStrategy issue

Posted by hwaastad <he...@waastad.org>.
Hi,
just to add some ingredience to the puzzel:

Switching to openjpa-2.3.0 it works without using
entitymanagerconfig.......and @PersitenceContext in producer.

hw



--
View this message in context: http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/ContainerManagedTransactionStrategy-issue-tp4659285p4659292.html
Sent from the Apache DeltaSpike Incubator Discussions mailing list archive at Nabble.com.

Re: ContainerManagedTransactionStrategy issue

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hello

a persistence unit is not JTA AFAIK so you need to produce an entity
manager instead of an entity manager factory.


Romain Manni-Bucau
@rmannibucau
http://www.tomitribe.com
http://rmannibucau.wordpress.com
https://github.com/rmannibucau


2014-10-28 12:40 GMT+01:00 hwaastad <he...@waastad.org>:
> Right,
> so it mean I might use persitenceunit in producer to create a application
> managed entitymanager and still use JTA.
>
> You mentioned you did not think it could be a DS issue.
> Maybe Mark og Romain could comment?
>
> Romain commented earlier that maybe a custom transactionstrategy should be
> used (maybe by Specializing), but I yet do not know how.
>
> br hw
>
>
>
>
> --
> View this message in context: http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/ContainerManagedTransactionStrategy-issue-tp4659285p4659290.html
> Sent from the Apache DeltaSpike Incubator Discussions mailing list archive at Nabble.com.

Re: ContainerManagedTransactionStrategy issue

Posted by hwaastad <he...@waastad.org>.
Right,
so it mean I might use persitenceunit in producer to create a application
managed entitymanager and still use JTA.

You mentioned you did not think it could be a DS issue.
Maybe Mark og Romain could comment?

Romain commented earlier that maybe a custom transactionstrategy should be
used (maybe by Specializing), but I yet do not know how.

br hw




--
View this message in context: http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/ContainerManagedTransactionStrategy-issue-tp4659285p4659290.html
Sent from the Apache DeltaSpike Incubator Discussions mailing list archive at Nabble.com.

Re: ContainerManagedTransactionStrategy issue

Posted by Thomas Hug <th...@gmail.com>.
>From the Spec (2.0) 7.5 Controlling Transactions: An application-managed
entity manager may be either a JTA entity manager or a resource-local
entity manager.

On Tue, Oct 28, 2014 at 11:46 AM, Thomas Hug <th...@gmail.com> wrote:

> Hi Helge
> Hmmm wouldn't be aware of that. Sounds to me like "You can only use JTA
> with EJBs in CMT mode"? ;-) Have to check the spec.
> Anyway, don't think it's a DS issue - if you do the same in the
> EMResolver, it works fine. Maybe someone else has a better insight on the
> CDI side here.
>
> On Tue, Oct 28, 2014 at 11:27 AM, hwaastad <he...@waastad.org> wrote:
>
>> Hi TH,
>> I know it'll work using PersistenceUnit but then again are'nt I using a
>> resource_local em?
>>
>> I try to read the specs regarding JTA and somewhere I read: "You are not
>> allowed to use @PersistenceUnit to refer to a unit of type JTA"
>>
>> I will happily help debugging this issue, but I'm a little bit over my
>> head
>> when it comes to debugging DS code.
>>
>> If you have any recommendations, I'll start digging further.
>>
>> br hw
>>
>>
>>
>> --
>> View this message in context:
>> http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/ContainerManagedTransactionStrategy-issue-tp4659285p4659287.html
>> Sent from the Apache DeltaSpike Incubator Discussions mailing list
>> archive at Nabble.com.
>>
>
>

Re: ContainerManagedTransactionStrategy issue

Posted by Thomas Hug <th...@gmail.com>.
Hi Helge
Hmmm wouldn't be aware of that. Sounds to me like "You can only use JTA
with EJBs in CMT mode"? ;-) Have to check the spec.
Anyway, don't think it's a DS issue - if you do the same in the EMResolver,
it works fine. Maybe someone else has a better insight on the CDI side here.

On Tue, Oct 28, 2014 at 11:27 AM, hwaastad <he...@waastad.org> wrote:

> Hi TH,
> I know it'll work using PersistenceUnit but then again are'nt I using a
> resource_local em?
>
> I try to read the specs regarding JTA and somewhere I read: "You are not
> allowed to use @PersistenceUnit to refer to a unit of type JTA"
>
> I will happily help debugging this issue, but I'm a little bit over my head
> when it comes to debugging DS code.
>
> If you have any recommendations, I'll start digging further.
>
> br hw
>
>
>
> --
> View this message in context:
> http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/ContainerManagedTransactionStrategy-issue-tp4659285p4659287.html
> Sent from the Apache DeltaSpike Incubator Discussions mailing list archive
> at Nabble.com.
>