-
15. Re: Bootstrap JTA in unit test
vasilievip Dec 18, 2013 1:03 PM (in response to tomjenkinson)Tom Jenkinson wrote:
Its not really the best way to report an issue by raising a pull request on the QS repo
Yeah, thats true. Let me quote his response here:
Gytis wrote:
I have checked Hibernate's trace logging and apparently it cannot join the JTA transaction during the invoke of TestEntityRepository.save method. The problem is that transaction is created before EntityManager, which by default cannot join such transaction. What you need to do is either create EntityManager when the transaction is active i.e. inside TestEntityRepository.save and TestEntityRepository.findAll methods or invoke entityManager.joinTransaction() inside of @Transactional method.
Here is a stack overflow link which explains the problem: Skipping JTA sync registration due to auto join checking
So, basically EntityManager cannot "automatically" join transaction in my code.
Tom Jenkinson wrote:
I think Gytis has answered your question on the PR?
Yes, that was very helpful. Now I'm wondering what is the best way to make it automatically "join" JTA transaction w/o touching application code
BTW: If I'll plug "entityManager.joinTransaction()" into sample code - it works just fine. Should I go ahead and create JIRA ticket and make another pull request which will have my testcase available in samples?
-
16. Re: Bootstrap JTA in unit test
vasilievip Dec 28, 2013 1:24 PM (in response to vasilievip)Here are my results:
- Deltaspike team says lgpl is not compatible with apache license: https://issues.apache.org/jira/browse/DELTASPIKE-473
- Sample project which shows JbossTM integration with deltaspike: vasilievip/cdi-jpa-jta-generic-dao · GitHub
-
17. Re: Bootstrap JTA in unit test
tomjenkinson Jan 9, 2014 9:57 AM (in response to vasilievip)Hi Ivan,
Did you manage to get answers to your questions, if not please do let us know what status you are at and we can pick it up again.
Thanks,
Tom -
18. Re: Bootstrap JTA in unit test
vasilievip Jan 9, 2014 10:11 AM (in response to tomjenkinson)Hi Tom,
Yes, I managed to get JbossTM in unit tests with help of your team. There is also example available in JbossTM quickstarts:
I'm also managed to use CdiTestRunner from deltaspike with JbossTM for my unit tests to unit-test CMP (I can't say "integration-test" because of tests speed , and this looks very cool:
Thanks,
Ivan
-
19. Re: Bootstrap JTA in unit test
tomjenkinson Jan 9, 2014 10:24 AM (in response to vasilievip)Great, thanks for the update - glad you managed to get it working
-
20. Re: Bootstrap JTA in unit test
vasilievip Jan 9, 2014 11:28 AM (in response to tomjenkinson)BTW: The JTA+JMS+CDI in unit tests is also very common case, example in quickstarts would be very nice to have: