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

Moves to Jakarta #486

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 4 additions & 2 deletions billy-andorra/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@

<!-- PERSISTENCE -->
<dependency>
<groupId>org.hibernate</groupId>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-core</artifactId>
</dependency>

<dependency>
<groupId>org.hibernate</groupId>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-envers</artifactId>
</dependency>

Expand All @@ -64,6 +64,7 @@
<groupId>com.querydsl</groupId>
<artifactId>querydsl-jpa</artifactId>
<version>${querydsl.version}</version>
<classifier>jakarta</classifier>
<scope>provided</scope>
</dependency>

Expand Down Expand Up @@ -169,6 +170,7 @@
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>${querydsl.version}</version>
<classifier>jakarta</classifier>
</dependency>
</dependencies>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.google.inject.Inject;
import com.google.inject.persist.PersistService;
import com.google.inject.persist.jpa.JpaPersistModule;
import com.google.inject.persist.jpa.JpaPersistOptions;

public class AndorraPersistenceDependencyModule extends AbstractModule {

Expand All @@ -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();
Copy link
Member

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

Copy link
Member Author

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.

JpaPersistModule persistModule = new JpaPersistModule(this.persistenceUnitId, options);
this.install(persistModule);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
import com.premiumminds.billy.andorra.util.Receipts;
import com.premiumminds.billy.andorra.util.SimpleInvoices;
import com.premiumminds.billy.andorra.util.Taxes;
import javax.inject.Inject;
import javax.inject.Singleton;
import jakarta.inject.Inject;
import jakarta.inject.Singleton;

import com.google.inject.Guice;
import com.google.inject.Injector;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

import com.premiumminds.billy.andorra.persistence.entities.ADGenericInvoiceEntryEntity;
import com.premiumminds.billy.andorra.persistence.entities.jpa.JPAADGenericInvoiceEntryEntity;
import javax.inject.Inject;
import javax.inject.Provider;
import javax.persistence.EntityManager;
import jakarta.inject.Inject;
import jakarta.inject.Provider;
import jakarta.persistence.EntityManager;

import com.premiumminds.billy.persistence.dao.jpa.AbstractDAOGenericInvoiceEntryImpl;
import com.premiumminds.billy.andorra.persistence.dao.AbstractDAOADGenericInvoiceEntry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import com.premiumminds.billy.andorra.persistence.entities.jpa.JPAADGenericInvoiceEntity;
import com.premiumminds.billy.andorra.persistence.entities.jpa.QJPAADBusinessEntity;
import com.premiumminds.billy.andorra.persistence.entities.jpa.QJPAADGenericInvoiceEntity;
import javax.inject.Inject;
import javax.inject.Provider;
import javax.persistence.EntityManager;
import jakarta.inject.Inject;
import jakarta.inject.Provider;
import jakarta.persistence.EntityManager;

import com.premiumminds.billy.core.services.StringID;
import com.premiumminds.billy.core.services.entities.Business;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

import com.premiumminds.billy.andorra.persistence.entities.ADAddressEntity;
import com.premiumminds.billy.andorra.persistence.entities.jpa.JPAADAddressEntity;
import javax.inject.Inject;
import javax.inject.Provider;
import javax.persistence.EntityManager;
import jakarta.inject.Inject;
import jakarta.inject.Provider;
import jakarta.persistence.EntityManager;

import com.premiumminds.billy.persistence.dao.jpa.DAOAddressImpl;
import com.premiumminds.billy.andorra.persistence.dao.DAOADAddress;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
package com.premiumminds.billy.andorra.persistence.dao.jpa;

import com.premiumminds.billy.andorra.persistence.entities.ADApplicationEntity;
import javax.inject.Inject;
import javax.inject.Provider;
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import jakarta.inject.Inject;
import jakarta.inject.Provider;
import jakarta.persistence.EntityManager;
import jakarta.persistence.NoResultException;

import com.premiumminds.billy.core.services.StringID;
import com.premiumminds.billy.core.services.entities.Application;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
package com.premiumminds.billy.andorra.persistence.dao.jpa;

import com.premiumminds.billy.andorra.persistence.entities.ADBusinessEntity;
import javax.inject.Inject;
import javax.inject.Provider;
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import jakarta.inject.Inject;
import jakarta.inject.Provider;
import jakarta.persistence.EntityManager;
import jakarta.persistence.NoResultException;

import com.premiumminds.billy.core.services.StringID;
import com.premiumminds.billy.core.services.entities.Business;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
package com.premiumminds.billy.andorra.persistence.dao.jpa;

import com.premiumminds.billy.andorra.persistence.entities.ADContactEntity;
import javax.inject.Inject;
import javax.inject.Provider;
import javax.persistence.EntityManager;
import jakarta.inject.Inject;
import jakarta.inject.Provider;
import jakarta.persistence.EntityManager;

import com.premiumminds.billy.persistence.dao.jpa.DAOContactImpl;
import com.premiumminds.billy.andorra.persistence.dao.DAOADContact;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
import com.premiumminds.billy.andorra.persistence.entities.jpa.QJPAADCreditNoteEntity;
import com.premiumminds.billy.andorra.persistence.entities.jpa.QJPAADCreditNoteEntryEntity;
import com.premiumminds.billy.andorra.services.entities.ADInvoice;
import javax.inject.Inject;
import javax.inject.Provider;
import javax.persistence.EntityManager;
import jakarta.inject.Inject;
import jakarta.inject.Provider;
import jakarta.persistence.EntityManager;

import com.premiumminds.billy.andorra.persistence.dao.DAOADCreditNoteEntry;
import com.premiumminds.billy.andorra.persistence.entities.jpa.JPAADCreditNoteEntity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
import com.premiumminds.billy.andorra.services.entities.ADCreditNote;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import javax.inject.Provider;
import javax.persistence.EntityManager;
import jakarta.inject.Inject;
import jakarta.inject.Provider;
import jakarta.persistence.EntityManager;

import com.premiumminds.billy.core.services.StringID;
import com.premiumminds.billy.core.services.entities.Business;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
import com.premiumminds.billy.andorra.persistence.entities.jpa.QJPAADCreditReceiptEntity;
import com.premiumminds.billy.andorra.persistence.entities.jpa.QJPAADCreditReceiptEntryEntity;
import com.premiumminds.billy.andorra.services.entities.ADReceipt;
import javax.inject.Inject;
import javax.inject.Provider;
import javax.persistence.EntityManager;
import jakarta.inject.Inject;
import jakarta.inject.Provider;
import jakarta.persistence.EntityManager;

import com.premiumminds.billy.andorra.persistence.dao.DAOADCreditReceiptEntry;
import com.premiumminds.billy.andorra.persistence.entities.jpa.JPAADCreditReceiptEntity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
import com.querydsl.jpa.JPQLQuery;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import javax.inject.Provider;
import javax.persistence.EntityManager;
import jakarta.inject.Inject;
import jakarta.inject.Provider;
import jakarta.persistence.EntityManager;

public class DAOADCreditReceiptImpl extends AbstractDAOADGenericInvoiceImpl<ADCreditReceiptEntity, JPAADCreditReceiptEntity>
implements DAOADCreditReceipt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
package com.premiumminds.billy.andorra.persistence.dao.jpa;

import com.premiumminds.billy.andorra.persistence.entities.ADCustomerEntity;
import javax.inject.Inject;
import javax.inject.Provider;
import javax.persistence.EntityManager;
import jakarta.inject.Inject;
import jakarta.inject.Provider;
import jakarta.persistence.EntityManager;

import com.premiumminds.billy.persistence.dao.jpa.DAOCustomerImpl;
import com.premiumminds.billy.andorra.persistence.dao.DAOADCustomer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

import com.premiumminds.billy.andorra.persistence.entities.ADGenericInvoiceEntryEntity;
import com.premiumminds.billy.andorra.persistence.entities.jpa.JPAADGenericInvoiceEntryEntity;
import javax.inject.Inject;
import javax.inject.Provider;
import javax.persistence.EntityManager;
import jakarta.inject.Inject;
import jakarta.inject.Provider;
import jakarta.persistence.EntityManager;

import com.premiumminds.billy.andorra.persistence.dao.DAOADGenericInvoiceEntry;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

import com.premiumminds.billy.andorra.persistence.entities.ADGenericInvoiceEntity;
import com.premiumminds.billy.andorra.persistence.entities.jpa.JPAADGenericInvoiceEntity;
import javax.inject.Inject;
import javax.inject.Provider;
import javax.persistence.EntityManager;
import jakarta.inject.Inject;
import jakarta.inject.Provider;
import jakarta.persistence.EntityManager;

import com.premiumminds.billy.andorra.persistence.dao.DAOADGenericInvoice;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
package com.premiumminds.billy.andorra.persistence.dao.jpa;

import com.premiumminds.billy.andorra.persistence.entities.ADInvoiceEntryEntity;
import javax.inject.Inject;
import javax.inject.Provider;
import javax.persistence.EntityManager;
import jakarta.inject.Inject;
import jakarta.inject.Provider;
import jakarta.persistence.EntityManager;

import com.premiumminds.billy.andorra.persistence.dao.DAOADInvoiceEntry;
import com.premiumminds.billy.andorra.persistence.entities.jpa.JPAADInvoiceEntryEntity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
package com.premiumminds.billy.andorra.persistence.dao.jpa;

import com.premiumminds.billy.andorra.persistence.entities.ADInvoiceEntity;
import javax.inject.Inject;
import javax.inject.Provider;
import javax.persistence.EntityManager;
import jakarta.inject.Inject;
import jakarta.inject.Provider;
import jakarta.persistence.EntityManager;

import com.premiumminds.billy.andorra.persistence.dao.DAOADInvoice;
import com.premiumminds.billy.andorra.persistence.entities.jpa.JPAADInvoiceEntity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
package com.premiumminds.billy.andorra.persistence.dao.jpa;

import com.premiumminds.billy.andorra.persistence.entities.ADPaymentEntity;
import javax.inject.Inject;
import javax.inject.Provider;
import javax.persistence.EntityManager;
import jakarta.inject.Inject;
import jakarta.inject.Provider;
import jakarta.persistence.EntityManager;

import com.premiumminds.billy.persistence.dao.jpa.DAOPaymentImpl;
import com.premiumminds.billy.andorra.persistence.dao.DAOADPayment;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

import com.premiumminds.billy.andorra.persistence.entities.ADProductEntity;
import com.premiumminds.billy.andorra.persistence.entities.jpa.JPAADProductEntity;
import javax.inject.Inject;
import javax.inject.Provider;
import javax.persistence.EntityManager;
import jakarta.inject.Inject;
import jakarta.inject.Provider;
import jakarta.persistence.EntityManager;

import com.premiumminds.billy.persistence.dao.jpa.DAOProductImpl;
import com.premiumminds.billy.andorra.persistence.dao.DAOADProduct;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

import com.premiumminds.billy.andorra.persistence.entities.ADReceiptEntryEntity;
import com.premiumminds.billy.andorra.persistence.entities.jpa.JPAADReceiptEntryEntity;
import javax.inject.Inject;
import javax.inject.Provider;
import javax.persistence.EntityManager;
import jakarta.inject.Inject;
import jakarta.inject.Provider;
import jakarta.persistence.EntityManager;

import com.premiumminds.billy.andorra.persistence.dao.DAOADReceiptEntry;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
package com.premiumminds.billy.andorra.persistence.dao.jpa;

import com.premiumminds.billy.andorra.persistence.entities.ADReceiptEntity;
import javax.inject.Inject;
import javax.inject.Provider;
import javax.persistence.EntityManager;
import jakarta.inject.Inject;
import jakarta.inject.Provider;
import jakarta.persistence.EntityManager;

import com.premiumminds.billy.andorra.persistence.dao.DAOADReceipt;
import com.premiumminds.billy.andorra.persistence.entities.jpa.JPAADReceiptEntity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

import com.premiumminds.billy.andorra.persistence.entities.ADRegionContextEntity;
import com.premiumminds.billy.andorra.persistence.entities.jpa.JPAADRegionContextEntity;
import javax.inject.Inject;
import javax.inject.Provider;
import javax.persistence.EntityManager;
import jakarta.inject.Inject;
import jakarta.inject.Provider;
import jakarta.persistence.EntityManager;

import com.premiumminds.billy.persistence.dao.jpa.DAOContextImpl;
import com.premiumminds.billy.andorra.persistence.dao.DAOADRegionContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

import com.premiumminds.billy.andorra.persistence.entities.ADShippingPointEntity;
import com.premiumminds.billy.andorra.persistence.entities.jpa.JPAADShippingPointEntity;
import javax.inject.Inject;
import javax.inject.Provider;
import javax.persistence.EntityManager;
import jakarta.inject.Inject;
import jakarta.inject.Provider;
import jakarta.persistence.EntityManager;

import com.premiumminds.billy.persistence.dao.jpa.DAOShippingPointImpl;
import com.premiumminds.billy.andorra.persistence.dao.DAOADShippingPoint;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

import com.premiumminds.billy.andorra.persistence.entities.ADSimpleInvoiceEntity;
import com.premiumminds.billy.andorra.persistence.entities.jpa.JPAADSimpleInvoiceEntity;
import javax.inject.Inject;
import javax.inject.Provider;
import javax.persistence.EntityManager;
import jakarta.inject.Inject;
import jakarta.inject.Provider;
import jakarta.persistence.EntityManager;

import com.premiumminds.billy.andorra.persistence.dao.DAOADSimpleInvoice;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

import com.premiumminds.billy.andorra.persistence.entities.ADSupplierEntity;
import com.premiumminds.billy.andorra.persistence.entities.jpa.JPAADSupplierEntity;
import javax.inject.Inject;
import javax.inject.Provider;
import javax.persistence.EntityManager;
import jakarta.inject.Inject;
import jakarta.inject.Provider;
import jakarta.persistence.EntityManager;

import com.premiumminds.billy.persistence.dao.jpa.DAOSupplierImpl;
import com.premiumminds.billy.andorra.persistence.dao.DAOADSupplier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
import java.util.Date;
import java.util.List;

import javax.inject.Inject;
import javax.inject.Provider;
import javax.persistence.EntityManager;
import jakarta.inject.Inject;
import jakarta.inject.Provider;
import jakarta.persistence.EntityManager;

import com.premiumminds.billy.persistence.dao.jpa.DAOTaxImpl;
import com.premiumminds.billy.andorra.persistence.dao.DAOADTax;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
*/
package com.premiumminds.billy.andorra.persistence.entities.jpa;

import javax.persistence.Entity;
import javax.persistence.Table;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;

import org.hibernate.envers.Audited;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import com.premiumminds.billy.andorra.persistence.entities.ADApplicationEntity;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.Table;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;

import org.hibernate.envers.Audited;

Expand Down
Loading
Loading