-
Notifications
You must be signed in to change notification settings - Fork 16
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
Moves to Jakarta #486
base: master
Are you sure you want to change the base?
Moves to Jakarta #486
Conversation
@@ -33,7 +34,8 @@ public AndorraPersistenceDependencyModule(String persistenceUnitId) { | |||
|
|||
@Override | |||
protected void configure() { | |||
JpaPersistModule persistModule = new JpaPersistModule(this.persistenceUnitId); | |||
final var options = JpaPersistOptions.builder().setAutoBeginWorkOnEntityManagerCreation(true).build(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was the reason for this change? Was the default behavior before to auto start work when the entity manager was created but the new version does not do this?
Consider this question as applying to the equivalent change in the other modules
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/google/guice/wiki/Guice600#persist
Persist had a number of changes, some of which are backwards incompatible. Notably: injection of EntityManager no longer implicitly starts a unit of work (because this led to leaks). Users can opt-in to the legacy behavior by constructing the JpaPersistModule with a JpaPersistOptions that sets setAutoBeginWorkOnEntityManagerCreation to true.
I was trying to keep the same behavior and only perform a javax -> jakarta change.
This is failling: public static void main(String[] args) {
final var options = JpaPersistOptions.builder().setAutoBeginWorkOnEntityManagerCreation(true).build();
Injector injector = Guice.createInjector(new PortugalDependencyModule(),
new SpainDependencyModule(),
new AndorraDependencyModule(),
new JpaPersistModule("application-persistence-unit", options));
injector.getInstance(PersistService.class).start();
var uid = "a998f2d8-76a0-4fe3-b820-56bb45dc95fb";
DAOPTInvoice daoPTInvoice = injector.getInstance(DAOPTInvoice.class);
PTInvoiceEntity entity = daoPTInvoice.get(StringID.fromValue(uid));
System.err.println(entity.getEntries());
injector.getInstance(PersistService.class).stop();
} with:
This is a limit in Seems related to: |
0ff9909
to
cdf1542
Compare
<querydsl.version>5.0.0</querydsl.version> | ||
<hibernate.version>5.6.15.Final</hibernate.version> | ||
<hibernate.version>6.3.1.Final</hibernate.version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving to Jakarta does not require to upgrade to Hibernate v6
We can move to hibernate-core-jakarta
fixes #157