Re: ContainerManagedTransactionStrategy issue

2014-10-29 Thread hwaastad
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

2014-10-29 Thread hwaastad
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.


ContainerManagedTransactionStrategy issue

2014-10-28 Thread hwaastad
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

2014-10-28 Thread Thomas Hug
Hi Helge,
Not sure what's wrong with the EM producer. Some CDI side effect maybe?
Anyway, if you use an EntityManagerFactory in the producer, the sample goes
green again.

On Tue, Oct 28, 2014 at 9:40 AM, hwaastad he...@waastad.org wrote:

 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

2014-10-28 Thread hwaastad
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

2014-10-28 Thread Thomas Hug
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

2014-10-28 Thread Thomas Hug
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 thomas@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

2014-10-28 Thread hwaastad
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

2014-10-28 Thread Romain Manni-Bucau
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

2014-10-28 Thread hwaastad
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

2014-10-28 Thread hwaastad
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

2014-10-06 Thread hwaastad
Hi,
those two are just for enabling result query cache by default on
namedqueries and flush on commit (needed for using lookups in custom
validators, if not setting flushmode on entitymanager, that is...)

br hw



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


Re: ContainerManagedTransactionStrategy

2014-10-06 Thread Thomas Hug
Can you remove the ApplicationScoped on the EMProducer and see if that
helps?

On Sun, Oct 5, 2014 at 4:58 PM, hwaastad he...@waastad.org wrote:

 Hi TH,
 and thanks for answering.

 I'm running JTA datasource and running repository within an EJB
 transaction.

 However, what I found out is that I need the entoitymanagerconfig with
 resolver or else this error occurs.

 I've made a simple test project
 (https://github.com/hwaastad/TomeeDsValidation.git)

 So if you remove the
 @EntityManagerConfig(entityManagerResolver =
 CrmEntityManagerResolver.class,flushMode = FlushModeType.COMMIT)

 Then this error will occure.
 Any idea why?


 br hw



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



Re: ContainerManagedTransactionStrategy

2014-10-06 Thread hwaastad
)
at java.lang.reflect.Method.invoke(Method.java:606)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at
org.apache.openejb.junit.jee.statement.InjectStatement.evaluate(InjectStatement.java:77)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at
org.apache.openejb.junit.jee.statement.DecoratingStatement.evaluate(DecoratingStatement.java:32)
at
org.apache.openejb.junit.jee.statement.DecoratingStatement.evaluate(DecoratingStatement.java:32)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at
org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
at
org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
at
org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at
org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
at
org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
at
org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)
at
org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)
at 
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)
Caused by: java.lang.NullPointerException
at
org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getIdentifier(EntityManagerFactoryImpl.java:85)
at
org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getIdentifier(EntityManagerFactoryDelegate.java:715)
... 77 more




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


Re: ContainerManagedTransactionStrategy

2014-10-05 Thread Thomas Hug
This should be used with a JTA datasource and the call to the repository
typically goes through an EJB starting the transaction.
Do you have some more context to the error?

On Fri, Oct 3, 2014 at 4:58 PM, hwaastad he...@waastad.org wrote:

 Hi,
 i was wondering if there is any doc on the usage of
 ContainerManagedTransactionStrategy?

 I've been trying to add this in beans.xml, but I only get a:

 javax.persistence.PersistenceException: java.lang.NullPointerException
 at

 org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getIdentifier(EntityManagerFactoryDelegate.java:719)
 at

 org.apache.deltaspike.data.impl.handler.CdiQueryInvocationContext.isNew(CdiQueryInvocationContext.java:93)
 .
 .
 .

 Caused by: java.lang.NullPointerException
 at

 org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getIdentifier(EntityManagerFactoryImpl.java:85)
 at

 org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getIdentifier(EntityManagerFactoryDelegate.java:715)

 br hw



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



Re: ContainerManagedTransactionStrategy

2014-10-05 Thread hwaastad
Hi TH,
and thanks for answering.

I'm running JTA datasource and running repository within an EJB transaction.

However, what I found out is that I need the entoitymanagerconfig with
resolver or else this error occurs.

I've made a simple test project
(https://github.com/hwaastad/TomeeDsValidation.git)

So if you remove the
@EntityManagerConfig(entityManagerResolver =
CrmEntityManagerResolver.class,flushMode = FlushModeType.COMMIT)

Then this error will occure.
Any idea why?


br hw



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


Re: ContainerManagedTransactionStrategy

2014-10-05 Thread Karl Kildén
I use TomEE with Eclipselink and have no issues. I do not recognize nor use
the eclipselink properties you have in persistence.xml. Otherwise we have
very similar configuration.



On 5 October 2014 16:58, hwaastad he...@waastad.org wrote:

 Hi TH,
 and thanks for answering.

 I'm running JTA datasource and running repository within an EJB
 transaction.

 However, what I found out is that I need the entoitymanagerconfig with
 resolver or else this error occurs.

 I've made a simple test project
 (https://github.com/hwaastad/TomeeDsValidation.git)

 So if you remove the
 @EntityManagerConfig(entityManagerResolver =
 CrmEntityManagerResolver.class,flushMode = FlushModeType.COMMIT)

 Then this error will occure.
 Any idea why?


 br hw



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



ContainerManagedTransactionStrategy

2014-10-03 Thread hwaastad
Hi,
i was wondering if there is any doc on the usage of
ContainerManagedTransactionStrategy?

I've been trying to add this in beans.xml, but I only get a:

javax.persistence.PersistenceException: java.lang.NullPointerException
at
org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getIdentifier(EntityManagerFactoryDelegate.java:719)
at
org.apache.deltaspike.data.impl.handler.CdiQueryInvocationContext.isNew(CdiQueryInvocationContext.java:93)
.
.
.

Caused by: java.lang.NullPointerException
at
org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getIdentifier(EntityManagerFactoryImpl.java:85)
at
org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getIdentifier(EntityManagerFactoryDelegate.java:715)

br hw



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


[jira] [Updated] (DELTASPIKE-554) ContainerManagedTransactionStrategy

2014-03-31 Thread Gerhard Petracek (JIRA)

 [ 
https://issues.apache.org/jira/browse/DELTASPIKE-554?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gerhard Petracek updated DELTASPIKE-554:


Attachment: (was: DELTASPIKE-554.patch)

 ContainerManagedTransactionStrategy
 ---

 Key: DELTASPIKE-554
 URL: https://issues.apache.org/jira/browse/DELTASPIKE-554
 Project: DeltaSpike
  Issue Type: Improvement
  Components: Data-Module, JPA-Module
Affects Versions: 0.6
Reporter: Gerhard Petracek
Assignee: Gerhard Petracek
Priority: Minor
 Fix For: 0.7






--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Resolved] (DELTASPIKE-554) ContainerManagedTransactionStrategy

2014-03-31 Thread Gerhard Petracek (JIRA)

 [ 
https://issues.apache.org/jira/browse/DELTASPIKE-554?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gerhard Petracek resolved DELTASPIKE-554.
-

Resolution: Fixed

 ContainerManagedTransactionStrategy
 ---

 Key: DELTASPIKE-554
 URL: https://issues.apache.org/jira/browse/DELTASPIKE-554
 Project: DeltaSpike
  Issue Type: Improvement
  Components: Data-Module, JPA-Module
Affects Versions: 0.6
Reporter: Gerhard Petracek
Assignee: Gerhard Petracek
Priority: Minor
 Fix For: 0.7






--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Created] (DELTASPIKE-554) ContainerManagedTransactionStrategy

2014-03-30 Thread Gerhard Petracek (JIRA)
Gerhard Petracek created DELTASPIKE-554:
---

 Summary: ContainerManagedTransactionStrategy
 Key: DELTASPIKE-554
 URL: https://issues.apache.org/jira/browse/DELTASPIKE-554
 Project: DeltaSpike
  Issue Type: Improvement
  Components: Data-Module, JPA-Module
Affects Versions: 0.6
Reporter: Gerhard Petracek
 Fix For: 0.7






--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Updated] (DELTASPIKE-554) ContainerManagedTransactionStrategy

2014-03-30 Thread Gerhard Petracek (JIRA)

 [ 
https://issues.apache.org/jira/browse/DELTASPIKE-554?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gerhard Petracek updated DELTASPIKE-554:


Priority: Minor  (was: Major)

 ContainerManagedTransactionStrategy
 ---

 Key: DELTASPIKE-554
 URL: https://issues.apache.org/jira/browse/DELTASPIKE-554
 Project: DeltaSpike
  Issue Type: Improvement
  Components: Data-Module, JPA-Module
Affects Versions: 0.6
Reporter: Gerhard Petracek
Priority: Minor
 Fix For: 0.7

 Attachments: DELTASPIKE-554.patch






--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Updated] (DELTASPIKE-554) ContainerManagedTransactionStrategy

2014-03-30 Thread Gerhard Petracek (JIRA)

 [ 
https://issues.apache.org/jira/browse/DELTASPIKE-554?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gerhard Petracek updated DELTASPIKE-554:


Attachment: DELTASPIKE-554.patch

 ContainerManagedTransactionStrategy
 ---

 Key: DELTASPIKE-554
 URL: https://issues.apache.org/jira/browse/DELTASPIKE-554
 Project: DeltaSpike
  Issue Type: Improvement
  Components: Data-Module, JPA-Module
Affects Versions: 0.6
Reporter: Gerhard Petracek
 Fix For: 0.7

 Attachments: DELTASPIKE-554.patch






--
This message was sent by Atlassian JIRA
(v6.2#6252)