Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolves JTA/JPA transaction synchronization issues #1473

Merged
merged 7 commits into from
Mar 7, 2020
Merged

Resolves JTA/JPA transaction synchronization issues #1473

merged 7 commits into from
Mar 7, 2020

Conversation

ljnelson
Copy link
Member

@ljnelson ljnelson commented Mar 5, 2020

Signed-off-by: Laird Nelson laird.nelson@oracle.com

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>
@ljnelson
Copy link
Member Author

ljnelson commented Mar 5, 2020

This PR, at a high level, ensures that Surefire will run twice (in normal operation): once using Eclipselink, and once using Hibernate. This ensures that our tests run against both major JPA providers we support.

To accomplish this, the pom.xml effectively copies classes into two "weaving areas"—areas where static bytecode enhancement can take place for each JPA provider without polluting the other's classes. Surefire is then configured to run against each weaving area so that the "right" classes are used at test time.

In addition, the Maven default executions—default-test and default-cli—are configured so that if they are invoked they work properly, though in such cases only the Eclipselink tests will be run.

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>
@ljnelson
Copy link
Member Author

ljnelson commented Mar 5, 2020

This PR also exposed several unspecified behaviors. In one, Eclipselink happily lets a once-managed-now-detached entity get re-persisted, whereas Hibernate throws an exception in such a use case. In another, Eclipselink defers acquiring database-generated identifiers until flush time; Hibernate seems to somehow come up with them early. Each of these cases is exactly the sort of thing that makes running our tests against both providers valuable.

…clipselink and Hibernate

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>
Signed-off-by: Laird Nelson <laird.nelson@oracle.com>
@ljnelson
Copy link
Member Author

ljnelson commented Mar 5, 2020

This PR also proves that transactional interceptor-governed methods work fine under Eclipselink and Hibernate.

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>
Signed-off-by: Laird Nelson <laird.nelson@oracle.com>
Signed-off-by: Laird Nelson <laird.nelson@oracle.com>
@ljnelson ljnelson changed the title Augmented JPA unit tests to run under both Eclipselink and Hibernate Resolves JTA/JPA transaction synchronization issues Mar 6, 2020
@ljnelson ljnelson requested a review from tjquinno March 6, 2020 23:02
@ljnelson ljnelson added this to In Progress in Backlog Mar 6, 2020
@ljnelson ljnelson merged commit 1d327c5 into helidon-io:master Mar 7, 2020
Backlog automation moved this from In Progress to Closed Mar 7, 2020
@ljnelson ljnelson deleted the jpa-hibernate-vs-eclipselink-2 branch March 7, 2020 00:44
@ljnelson ljnelson mentioned this pull request Mar 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Backlog
  
Closed
Development

Successfully merging this pull request may close these issues.

None yet

2 participants