Skip to content
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions framework/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ transitiveDependencies: false

# This core dependencies are required by Play framework
require: &allDependencies
- antlr 2.7.7
- com.mchange -> c3p0 0.10.1
- com.zaxxer -> HikariCP 5.1.0
- org.ow2.asm -> asm 9.7
Expand Down Expand Up @@ -55,19 +54,16 @@ require: &allDependencies
- org.codehaus.groovy -> groovy-xml 3.0.22
- org.eclipse.jdt -> org.eclipse.jdt.core 3.33.0
- org.eclipse.jdt -> ecj 3.33.0
- org.hibernate -> hibernate-core 5.6.5.Final.patched
- org.hibernate.orm -> hibernate-core 6.6.4.Final
- net.bytebuddy -> byte-buddy 1.15.0
- javax.persistence -> javax.persistence-api 2.2
- org.hibernate.common -> hibernate-commons-annotations 5.1.2.Final
- jakarta.persistence -> jakarta.persistence-api 3.1.0
- jakarta.transaction -> jakarta.transaction-api 2.0.1
- org.hibernate -> hibernate-validator 5.4.3.Final
- io.smallrye -> jandex 3.2.2
- org.jboss.logging -> jboss-logging 3.6.0.Final
- org.jboss.spec.javax.transaction -> jboss-transaction-api_1.2_spec 1.1.1.Final
- javax.xml.bind -> jaxb-api 2.3.1
- org.glassfish.jaxb -> jaxb-runtime 2.3.9
- com.fasterxml -> classmate 1.7.0
- org.hibernate -> hibernate-c3p0 5.6.15.Final
- org.hibernate -> hibernate-ehcache 5.6.15.Final
- com.mchange -> mchange-commons-java 0.3.1
- org.javassist -> javassist 3.30.2-GA
- io.netty -> netty 3.10.6.Final
Expand Down
Binary file removed framework/lib/antlr-2.7.7.jar
Binary file not shown.
Binary file removed framework/lib/hibernate-c3p0-5.6.15.Final.jar
Binary file not shown.
Binary file not shown.
Binary file removed framework/lib/hibernate-core-5.6.5.Final.patched.jar
Binary file not shown.
Binary file added framework/lib/hibernate-core-6.6.4.Final.jar
Binary file not shown.
Binary file removed framework/lib/hibernate-ehcache-5.6.15.Final.jar
Binary file not shown.
Binary file added framework/lib/jakarta.persistence-api-3.1.0.jar
Binary file not shown.
Binary file added framework/lib/jakarta.transaction-api-2.0.1.jar
Binary file not shown.
Binary file removed framework/lib/javax.persistence-api-2.2.jar
Binary file not shown.
Binary file not shown.
6 changes: 3 additions & 3 deletions framework/src/play/classloading/enhancers/Enhancer.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public URL find(String className) {
* @param ctClass
* the javassist class representation
* @param annotation
* fully qualified name of the annotation class eg."javax.persistence.Entity"
* fully qualified name of the annotation class eg."jakarta.persistence.Entity"
* @return true if class has the annotation
* @throws java.lang.ClassNotFoundException
* if class not found
Expand All @@ -132,7 +132,7 @@ protected boolean hasAnnotation(CtClass ctClass, String annotation) throws Class
* @param ctField
* the javassist field representation
* @param annotation
* fully qualified name of the annotation class eg."javax.persistence.Entity"
* fully qualified name of the annotation class eg."jakarta.persistence.Entity"
* @return true if field has the annotation
* @throws java.lang.ClassNotFoundException
* if class not found
Expand All @@ -153,7 +153,7 @@ protected boolean hasAnnotation(CtField ctField, String annotation) throws Class
* @param ctMethod
* the javassist method representation
* @param annotation
* fully qualified name of the annotation class eg."javax.persistence.Entity"
* fully qualified name of the annotation class eg."jakarta.persistence.Entity"
* @return true if field has the annotation
* @throws java.lang.ClassNotFoundException
* if class not found
Expand Down
5 changes: 2 additions & 3 deletions framework/src/play/db/DB.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
import javax.sql.rowset.CachedRowSet;
import javax.sql.rowset.RowSetProvider;

import org.hibernate.internal.SessionImpl;

import play.Logger;
import play.db.jpa.JPA;
import play.exceptions.DatabaseException;
Expand Down Expand Up @@ -171,7 +169,8 @@ public static void close(String name) {
public static Connection getConnection(String name) {
try {
if (JPA.isEnabled()) {
return JPA.em(name).unwrap(SessionImpl.class).getSession().connection();
return JPA.em(name).unwrap(org.hibernate.Session.class)
.doReturningWork(connection -> connection);
}

Connection localConnection = getLocalConnection(name);
Expand Down
2 changes: 1 addition & 1 deletion framework/src/play/db/evolutions/EvolutionQuery.java
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ private static synchronized boolean isOracleDialectInUse(String dbName) {
Class<?> dialectClass = Play.classloader.loadClass(jpaDialect);

// Oracle 8i dialect is the base class for oracle dialects (at least for now)
isOracle = org.hibernate.dialect.Oracle8iDialect.class.isAssignableFrom(dialectClass);
isOracle = org.hibernate.dialect.OracleDialect.class.isAssignableFrom(dialectClass);
} catch (ClassNotFoundException e) {
// swallow
Logger.warn("jpa.dialect class %s not found", jpaDialect);
Expand Down
2 changes: 1 addition & 1 deletion framework/src/play/db/helper/JpaHelper.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package play.db.helper;

import java.util.List;
import javax.persistence.Query;
import jakarta.persistence.Query;
import play.db.jpa.JPA;

public class JpaHelper {
Expand Down
41 changes: 20 additions & 21 deletions framework/src/play/db/jpa/Blob.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import org.hibernate.HibernateException;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.type.StringType;
import org.hibernate.usertype.UserType;

import play.Play;
Expand All @@ -21,7 +20,7 @@
import play.libs.Codec;
import play.libs.IO;

public class Blob implements BinaryField, UserType {
public class Blob implements BinaryField, UserType<Blob> {

private String UUID;
private String type;
Expand Down Expand Up @@ -81,45 +80,45 @@ public File getFile() {
}
return file;
}

public String getUUID() {
return UUID;
}

@Override
public int[] sqlTypes() {
return new int[] {Types.VARCHAR};
public int getSqlType() {
return Types.VARCHAR;
}

@Override
public Class returnedClass() {
public Class<Blob> returnedClass() {
return Blob.class;
}

@Override
public boolean equals(Object o, Object o1) throws HibernateException {
public boolean equals(Blob o, Blob o1) throws HibernateException {
if(o instanceof Blob && o1 instanceof Blob) {
return Objects.equals(((Blob) o).UUID, ((Blob) o1).UUID) &&
Objects.equals(((Blob)o).type, ((Blob)o1).type);
return Objects.equals(o.UUID, o1.UUID) &&
Objects.equals(o.type, o1.type);
}
return Objects.equals(o, o1);
}

@Override
public int hashCode(Object o) throws HibernateException {
public int hashCode(Blob o) throws HibernateException {
return o.hashCode();
}

@Override
public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException {
String val = (String) StringType.INSTANCE.nullSafeGet(rs, names[0], session, owner);
public Blob nullSafeGet(ResultSet rs, int position, SharedSessionContractImplementor session, Object owner) throws SQLException {
String val = rs.getString(position);
return new Blob(val);
}

@Override
public void nullSafeSet(PreparedStatement ps, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException {
public void nullSafeSet(PreparedStatement ps, Blob value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException {
if (value != null) {
ps.setString(index, encode((Blob) value));
ps.setString(index, encode(value));
} else {
ps.setNull(index, Types.VARCHAR);
}
Expand All @@ -130,11 +129,11 @@ private String encode(Blob o) {
}

@Override
public Object deepCopy(Object o) throws HibernateException {
public Blob deepCopy(Blob o) throws HibernateException {
if(o == null) {
return null;
}
return new Blob(((Blob)o).UUID, ((Blob)o).type);
return new Blob(o.UUID, o.type);
}

@Override
Expand All @@ -143,19 +142,19 @@ public boolean isMutable() {
}

@Override
public Serializable disassemble(Object o) throws HibernateException {
public Serializable disassemble(Blob o) throws HibernateException {
if (o == null) return null;
return encode((Blob) o);
return encode(o);
}

@Override
public Object assemble(Serializable cached, Object owner) throws HibernateException {
public Blob assemble(Serializable cached, Object owner) throws HibernateException {
if (cached == null) return null;
return new Blob((String) cached);
}

@Override
public Object replace(Object original, Object target, Object owner) throws HibernateException {
public Blob replace(Blob original, Blob target, Object owner) throws HibernateException {
return original;
}

Expand All @@ -174,5 +173,5 @@ public static File getStore() {
}
return store;
}

}
4 changes: 2 additions & 2 deletions framework/src/play/db/jpa/FileAttachment.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package play.db.jpa;

import java.io.File;
import javax.persistence.Embeddable;
import javax.persistence.Transient;
import jakarta.persistence.Embeddable;
import jakarta.persistence.Transient;
import play.Play;
import play.libs.Files;

Expand Down
38 changes: 19 additions & 19 deletions framework/src/play/db/jpa/GenericModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
import java.util.SortedSet;
import java.util.TreeSet;

import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
import javax.persistence.NoResultException;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.PostLoad;
import javax.persistence.PostPersist;
import javax.persistence.PostUpdate;
import javax.persistence.Query;
import jakarta.persistence.ManyToMany;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.MappedSuperclass;
import jakarta.persistence.NoResultException;
import jakarta.persistence.OneToMany;
import jakarta.persistence.OneToOne;
import jakarta.persistence.PostLoad;
import jakarta.persistence.PostPersist;
import jakarta.persistence.PostUpdate;
import jakarta.persistence.Query;

import org.apache.commons.lang3.StringUtils;

Expand Down Expand Up @@ -425,7 +425,7 @@ public <T extends JPABase> T delete() {
* @return The created entity.
*/
public static <T extends JPABase> T create(String name, Params params) {
throw new UnsupportedOperationException("Please annotate your JPA model with @javax.persistence.Entity annotation.");
throw new UnsupportedOperationException("Please annotate your JPA model with @jakarta.persistence.Entity annotation.");
}

/**
Expand All @@ -434,7 +434,7 @@ public static <T extends JPABase> T create(String name, Params params) {
* @return number of entities of this class
*/
public static long count() {
throw new UnsupportedOperationException("Please annotate your JPA model with @javax.persistence.Entity annotation.");
throw new UnsupportedOperationException("Please annotate your JPA model with @jakarta.persistence.Entity annotation.");
}

/**
Expand All @@ -447,7 +447,7 @@ public static long count() {
* @return A long
*/
public static long count(String query, Object... params) {
throw new UnsupportedOperationException("Please annotate your JPA model with @javax.persistence.Entity annotation.");
throw new UnsupportedOperationException("Please annotate your JPA model with @jakarta.persistence.Entity annotation.");
}

/**
Expand All @@ -458,7 +458,7 @@ public static long count(String query, Object... params) {
* @return All entities of this type
*/
public static <T extends JPABase> List<T> findAll() {
throw new UnsupportedOperationException("Please annotate your JPA model with @javax.persistence.Entity annotation.");
throw new UnsupportedOperationException("Please annotate your JPA model with @jakarta.persistence.Entity annotation.");
}

/**
Expand All @@ -471,7 +471,7 @@ public static <T extends JPABase> List<T> findAll() {
* @return The entity
*/
public static <T extends JPABase> T findById(Object id) {
throw new UnsupportedOperationException("Please annotate your JPA model with @javax.persistence.Entity annotation.");
throw new UnsupportedOperationException("Please annotate your JPA model with @jakarta.persistence.Entity annotation.");
}

/**
Expand All @@ -484,7 +484,7 @@ public static <T extends JPABase> T findById(Object id) {
* @return A JPAQuery
*/
public static JPAQuery find(String query, Object... params) {
throw new UnsupportedOperationException("Please annotate your JPA model with @javax.persistence.Entity annotation.");
throw new UnsupportedOperationException("Please annotate your JPA model with @jakarta.persistence.Entity annotation.");
}

/**
Expand All @@ -493,7 +493,7 @@ public static JPAQuery find(String query, Object... params) {
* @return A JPAQuery
*/
public static JPAQuery all() {
throw new UnsupportedOperationException("Please annotate your JPA model with @javax.persistence.Entity annotation.");
throw new UnsupportedOperationException("Please annotate your JPA model with @jakarta.persistence.Entity annotation.");
}

/**
Expand All @@ -506,7 +506,7 @@ public static JPAQuery all() {
* @return Number of entities deleted
*/
public static int delete(String query, Object... params) {
throw new UnsupportedOperationException("Please annotate your JPA model with @javax.persistence.Entity annotation.");
throw new UnsupportedOperationException("Please annotate your JPA model with @jakarta.persistence.Entity annotation.");
}

/**
Expand All @@ -515,7 +515,7 @@ public static int delete(String query, Object... params) {
* @return Number of entities deleted
*/
public static int deleteAll() {
throw new UnsupportedOperationException("Please annotate your JPA model with @javax.persistence.Entity annotation.");
throw new UnsupportedOperationException("Please annotate your JPA model with @jakarta.persistence.Entity annotation.");
}

/**
Expand Down
Loading
Loading