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:
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?
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
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.
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:
Great, thanks for the update - glad you managed to get it working
BTW: The JTA+JMS+CDI in unit tests is also very common case, example in quickstarts would be very nice to have: