Skip to content

Commit

Permalink
Upgrade to Hibernate 6.4
Browse files Browse the repository at this point in the history
  • Loading branch information
vladmihalcea committed May 16, 2024
1 parent 4ca38dc commit ce474c2
Show file tree
Hide file tree
Showing 35 changed files with 92 additions and 94 deletions.
11 changes: 5 additions & 6 deletions hypersistence-optimizer-config-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<groupId>io.hypersistence</groupId>
<artifactId>hypersistence-optimizer</artifactId>
<version>${hypersistence-optimizer.version}</version>
<classifier>jakarta</classifier>
</dependency>

<dependency>
Expand All @@ -48,12 +49,6 @@
<version>${hibernate.version}</version>
</dependency>

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate.version}</version>
</dependency>

<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
Expand Down Expand Up @@ -94,4 +89,8 @@
</dependency>
</dependencies>

<properties>
<jdk.version>11</jdk.version>
</properties>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
import io.hypersistence.optimizer.util.AbstractTest;
import org.junit.Test;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
import io.hypersistence.optimizer.util.AbstractTest;
import org.junit.Test;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import io.hypersistence.optimizer.util.providers.Database;
import org.junit.Test;

import javax.persistence.*;
import jakarta.persistence.*;

import static org.junit.Assert.fail;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import io.hypersistence.optimizer.util.AbstractTest;
import org.junit.Test;

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

import static org.junit.Assert.assertTrue;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
import io.hypersistence.optimizer.util.providers.Database;
import org.junit.Test;

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

import static org.junit.Assert.assertSame;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import io.hypersistence.optimizer.util.transaction.JPATransactionVoidFunction;
import org.junit.Test;

import javax.persistence.*;
import jakarta.persistence.*;

import java.util.Collections;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
<arquillian.junit.container.version>1.0.3.Final</arquillian.junit.container.version>
<arquillian.glassfish.version>1.0.0.CR3</arquillian.glassfish.version>
<glassfish.embedded.version>5.1.0</glassfish.embedded.version>
<hibernate.version>5.6.15.Final</hibernate.version>
</properties>

<build>
Expand Down
2 changes: 1 addition & 1 deletion hypersistence-optimizer-micronaut-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
<micronaut-data.version>3.9.6</micronaut-data.version>
<micronaut.test.resources.enabled>true</micronaut.test.resources.enabled>

<hypersistence-optimizer.version>2.8.1</hypersistence-optimizer.version>
<hypersistence-optimizer.version>2.8.2</hypersistence-optimizer.version>
</properties>

<build>
Expand Down
2 changes: 1 addition & 1 deletion hypersistence-optimizer-micronaut2-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
<micronaut-data.version>2.5.13</micronaut-data.version>
<micronaut.test.resources.enabled>true</micronaut.test.resources.enabled>

<hypersistence-optimizer.version>2.8.1</hypersistence-optimizer.version>
<hypersistence-optimizer.version>2.8.2</hypersistence-optimizer.version>
</properties>

<build>
Expand Down
11 changes: 4 additions & 7 deletions hypersistence-optimizer-spring-hibernate-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<groupId>io.hypersistence</groupId>
<artifactId>hypersistence-optimizer</artifactId>
<version>${hypersistence-optimizer.version}</version>
<classifier>jakarta</classifier>
</dependency>

<dependency>
Expand All @@ -40,12 +41,6 @@
<version>${hibernate.version}</version>
</dependency>

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate.version}</version>
</dependency>

<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
Expand Down Expand Up @@ -135,8 +130,10 @@
</dependencies>

<properties>
<jdk.version>17</jdk.version>

<aspectj.version>1.8.7</aspectj.version>
<spring.version>5.3.18</spring.version>
<spring.version>6.1.6</spring.version>
</properties>

</project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.hypersistence.optimizer.forum.dao;

import io.hypersistence.optimizer.forum.domain.Post;
import jakarta.persistence.criteria.CriteriaBuilder;
import jakarta.persistence.criteria.CriteriaQuery;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -59,9 +60,13 @@ public T persist(T entity) {
*/
@Override
public List<T> findAll(int maxResults) {
CriteriaBuilder builder = getSession().getCriteriaBuilder();
CriteriaQuery<T> criteria = builder.createQuery(entityClass);
criteria.from(entityClass);

return getSession()
.createCriteria(entityClass)
.createQuery(criteria)
.setMaxResults(maxResults)
.list();
.getResultList();
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.hypersistence.optimizer.forum.domain;

import javax.persistence.*;
import jakarta.persistence.*;
import java.util.ArrayList;
import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.hypersistence.optimizer.forum.domain;

import javax.persistence.*;
import jakarta.persistence.*;

/**
* @author Vlad Mihalcea
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.hypersistence.optimizer.forum.domain;

import javax.persistence.*;
import jakarta.persistence.*;
import java.util.Date;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package io.hypersistence.optimizer.forum.domain;

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

/**
* @author Vlad Mihalcea
Expand Down
11 changes: 4 additions & 7 deletions hypersistence-optimizer-spring-jpa-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<groupId>io.hypersistence</groupId>
<artifactId>hypersistence-optimizer</artifactId>
<version>${hypersistence-optimizer.version}</version>
<classifier>jakarta</classifier>
</dependency>

<dependency>
Expand All @@ -40,12 +41,6 @@
<version>${hibernate.version}</version>
</dependency>

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate.version}</version>
</dependency>

<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
Expand Down Expand Up @@ -135,8 +130,10 @@
</dependencies>

<properties>
<jdk.version>17</jdk.version>

<aspectj.version>1.8.7</aspectj.version>
<spring.version>5.3.18</spring.version>
<spring.version>6.1.6</spring.version>
</properties>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import jakarta.persistence.EntityManager;
import jakarta.persistence.PersistenceContext;
import jakarta.persistence.criteria.CriteriaBuilder;
import jakarta.persistence.criteria.CriteriaQuery;
import java.io.Serializable;
import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.hypersistence.optimizer.forum.domain;

import javax.persistence.*;
import jakarta.persistence.*;
import java.util.ArrayList;
import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.hypersistence.optimizer.forum.domain;

import javax.persistence.*;
import jakarta.persistence.*;

/**
* @author Vlad Mihalcea
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.hypersistence.optimizer.forum.domain;

import javax.persistence.*;
import jakarta.persistence.*;
import java.util.Date;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package io.hypersistence.optimizer.forum.domain;

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

/**
* @author Vlad Mihalcea
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import jakarta.persistence.EntityManager;
import jakarta.persistence.PersistenceContext;
import java.util.List;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.transaction.support.TransactionTemplate;

import javax.persistence.EntityManagerFactory;
import jakarta.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import java.util.Properties;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
import org.springframework.transaction.support.TransactionCallback;
import org.springframework.transaction.support.TransactionTemplate;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import jakarta.persistence.EntityManager;
import jakarta.persistence.PersistenceContext;
import java.util.List;

import static org.junit.Assert.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
import org.springframework.transaction.support.TransactionCallback;
import org.springframework.transaction.support.TransactionTemplate;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import jakarta.persistence.EntityManager;
import jakarta.persistence.PersistenceContext;
import java.util.List;

import static org.junit.Assert.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
import org.springframework.transaction.support.TransactionCallback;
import org.springframework.transaction.support.TransactionTemplate;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import jakarta.persistence.EntityManager;
import jakarta.persistence.PersistenceContext;
import java.util.List;

import static org.junit.Assert.*;
Expand Down
11 changes: 5 additions & 6 deletions hypersistence-optimizer-test-case/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<groupId>io.hypersistence</groupId>
<artifactId>hypersistence-optimizer</artifactId>
<version>${hypersistence-optimizer.version}</version>
<classifier>jakarta</classifier>
</dependency>

<dependency>
Expand All @@ -40,12 +41,6 @@
<version>${hibernate.version}</version>
</dependency>

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate.version}</version>
</dependency>

<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
Expand Down Expand Up @@ -110,4 +105,8 @@
</plugins>
</build>

<properties>
<jdk.version>11</jdk.version>
</properties>

</project>
Loading

0 comments on commit ce474c2

Please sign in to comment.