Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mattjlewis/helidontxtest
A simple project to test transactions when using JPA with Helidon.
https://github.com/mattjlewis/helidontxtest
eclipse-microprofile helidon helidon-mp-jpa java jpa2 microprofile microservices
Last synced: 17 days ago
JSON representation
A simple project to test transactions when using JPA with Helidon.
- Host: GitHub
- URL: https://github.com/mattjlewis/helidontxtest
- Owner: mattjlewis
- License: mit
- Created: 2019-12-12T08:29:42.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-01-07T18:00:01.000Z (almost 5 years ago)
- Last Synced: 2024-11-03T22:42:12.253Z (2 months ago)
- Topics: eclipse-microprofile, helidon, helidon-mp-jpa, java, jpa2, microprofile, microservices
- Language: Java
- Homepage:
- Size: 85 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Helidon Transaction Test
Simple project to test Helidon transactions when using JPA.
There is a useful [stackoverflow discussion](https://stackoverflow.com/questions/2360764/ejb3-transaction-rollback/2362881) on the Container Manager Transaction rollback logic that is implemented in EJB3.
1. If you throw your exception with @ApplicationException(rollback=true), you don't have to rollback the transaction manually. Context.setRollbackOnly() forces the container to rollback the transaction, also if there is no exception.
1. A checked exception itself doesn't rollback a transaction. It needs to have the annotation @ApplicationException(rollback=true). If the exception is a RuntimeException and the exception isn't caught, it forces the container to rollback the transaction. But watch out, the container will in this case discard the EJB instance.
1. As mentioned in 2.), if you throw a RuntimeException, the transaction will be rolled back automatically. If you catch an checked exception inside the code, you have to use setRollbackOnly to rollback the transaction.Useful articles:
1. [Tackling RESOURCE_LOCAL vs. JTA Under Java EE Umbrella and Payara Server](https://dzone.com/articles/resource-local-vs-jta-transaction-types-and-payara)