Add migration-5-to-7 module: Hibernate 5.6.15 vs 7.4.14 jar diff, compile checks, schema defaults and cheat-sheet snippets
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01YPgGH6aMbSLANL3E2HHmS6
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
5.x 7.x
|
||||
coordinates org.hibernate:hibernate-core:5.6.15.Final org.hibernate.orm:hibernate-core:7.4.14.Final
|
||||
class files Java 8 Java 17
|
||||
persistence javax.persistence (JPA 2.2) jakarta.persistence (Jakarta Persistence 3.2)
|
||||
@@ -0,0 +1,15 @@
|
||||
== hibernate-core: public classes missing: 828, members removed from classes that remain: 2735, new classes: 5879
|
||||
of the missing classes: 59 were deprecated in 5.6.15, 137 have a class of the same simple name somewhere in 7.4.14
|
||||
packages with the most missing classes:
|
||||
75 org.hibernate.dialect
|
||||
74 org.hibernate.type
|
||||
62 org.hibernate.type.descriptor.java
|
||||
59 org.hibernate.criterion
|
||||
53 org.hibernate.cfg
|
||||
36 org.hibernate.type.descriptor.sql
|
||||
35 org.hibernate.annotations
|
||||
27 org.hibernate.dialect.function
|
||||
25 org.hibernate.sql.ordering.antlr
|
||||
23 org.hibernate.sql
|
||||
23 org.hibernate.tool.hbm2ddl
|
||||
22 org.hibernate.cfg.annotations
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
||||
Hibernate 5.6.15, compiling OldHibernate.java
|
||||
javac exit status: 0
|
||||
@@ -0,0 +1,63 @@
|
||||
Hibernate 7.4.14, compiling OldHibernate.java
|
||||
src/compat/OldHibernate.java:4: error: cannot find symbol
|
||||
import org.hibernate.Criteria;
|
||||
^
|
||||
symbol: class Criteria
|
||||
location: package org.hibernate
|
||||
src/compat/OldHibernate.java:8: error: package org.hibernate.criterion does not exist
|
||||
import org.hibernate.criterion.Restrictions;
|
||||
^
|
||||
src/compat/OldHibernate.java:15: error: cannot find symbol
|
||||
return s.save(o);
|
||||
^
|
||||
symbol: method save(Object)
|
||||
location: variable s of type Session
|
||||
src/compat/OldHibernate.java:19: error: cannot find symbol
|
||||
s.update(o);
|
||||
^
|
||||
symbol: method update(Object)
|
||||
location: variable s of type Session
|
||||
src/compat/OldHibernate.java:23: error: cannot find symbol
|
||||
s.saveOrUpdate(o);
|
||||
^
|
||||
symbol: method saveOrUpdate(Object)
|
||||
location: variable s of type Session
|
||||
src/compat/OldHibernate.java:27: error: cannot find symbol
|
||||
s.delete(o);
|
||||
^
|
||||
symbol: method delete(Object)
|
||||
location: variable s of type Session
|
||||
src/compat/OldHibernate.java:31: error: incompatible types: void cannot be converted to Object
|
||||
return s.load(Object.class, 1L);
|
||||
^
|
||||
src/compat/OldHibernate.java:35: error: cannot find symbol
|
||||
Criteria c = s.createCriteria(Object.class).add(Restrictions.eq("name", "x"));
|
||||
^
|
||||
symbol: class Criteria
|
||||
location: class OldHibernate
|
||||
src/compat/OldHibernate.java:35: error: cannot find symbol
|
||||
Criteria c = s.createCriteria(Object.class).add(Restrictions.eq("name", "x"));
|
||||
^
|
||||
symbol: method createCriteria(Class<Object>)
|
||||
location: variable s of type Session
|
||||
src/compat/OldHibernate.java:35: error: cannot find symbol
|
||||
Criteria c = s.createCriteria(Object.class).add(Restrictions.eq("name", "x"));
|
||||
^
|
||||
symbol: variable Restrictions
|
||||
location: class OldHibernate
|
||||
src/compat/OldHibernate.java:40: error: cannot find symbol
|
||||
return s.createSQLQuery("select 1").list();
|
||||
^
|
||||
symbol: method createSQLQuery(String)
|
||||
location: variable s of type Session
|
||||
src/compat/OldHibernate.java:44: error: incompatible types: FlushMode cannot be converted to FlushModeType
|
||||
s.setFlushMode(FlushMode.AUTO);
|
||||
^
|
||||
src/compat/OldHibernate.java:48: error: cannot find symbol
|
||||
return sf.getClassMetadata(Object.class);
|
||||
^
|
||||
symbol: method getClassMetadata(Class<Object>)
|
||||
location: variable sf of type SessionFactory
|
||||
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
|
||||
13 errors
|
||||
javac exit status: 1
|
||||
@@ -0,0 +1,2 @@
|
||||
Hibernate 5.6.15, compiling NewHibernate.java
|
||||
javac exit status: 0
|
||||
@@ -0,0 +1,6 @@
|
||||
Hibernate 7.4.14, compiling NewHibernate.java
|
||||
src/compat/NewHibernate.java:34: warning: [deprecation] createNativeQuery(String) in Session has been deprecated
|
||||
return s.createNativeQuery("select 1").getResultList();
|
||||
^
|
||||
1 warning
|
||||
javac exit status: 0
|
||||
@@ -0,0 +1,2 @@
|
||||
Hibernate 5.6.15, compiling OldAnnotations.java
|
||||
javac exit status: 0
|
||||
@@ -0,0 +1,27 @@
|
||||
Hibernate 7.4.14, compiling OldAnnotations.java
|
||||
src/compat/OldAnnotations.java:3: error: cannot find symbol
|
||||
import org.hibernate.annotations.Where;
|
||||
^
|
||||
symbol: class Where
|
||||
location: package org.hibernate.annotations
|
||||
src/compat/OldAnnotations.java:7: error: cannot find symbol
|
||||
@Where(clause = "deleted = false")
|
||||
^
|
||||
symbol: class Where
|
||||
src/compat/OldAnnotations.java:10: error: cannot find symbol
|
||||
@Type(type = "yes_no")
|
||||
^
|
||||
symbol: method type()
|
||||
location: @interface Type
|
||||
src/compat/OldAnnotations.java:10: error: annotation @Type is missing a default value for the element 'value'
|
||||
@Type(type = "yes_no")
|
||||
^
|
||||
src/compat/OldAnnotations.java:13: warning: [removal] GenericGenerator in org.hibernate.annotations has been deprecated and marked for removal
|
||||
@GenericGenerator(name = "g", strategy = "increment")
|
||||
^
|
||||
src/compat/OldAnnotations.java:13: warning: [removal] strategy() in GenericGenerator has been deprecated and marked for removal
|
||||
@GenericGenerator(name = "g", strategy = "increment")
|
||||
^
|
||||
4 errors
|
||||
2 warnings
|
||||
javac exit status: 1
|
||||
@@ -0,0 +1,32 @@
|
||||
Hibernate 5.6.15, compiling NewAnnotations.java
|
||||
src/compat/NewAnnotations.java:1: error: cannot find symbol
|
||||
import org.hibernate.annotations.JdbcTypeCode;
|
||||
^
|
||||
symbol: class JdbcTypeCode
|
||||
location: package org.hibernate.annotations
|
||||
src/compat/NewAnnotations.java:2: error: cannot find symbol
|
||||
import org.hibernate.annotations.SQLRestriction;
|
||||
^
|
||||
symbol: class SQLRestriction
|
||||
location: package org.hibernate.annotations
|
||||
src/compat/NewAnnotations.java:3: error: cannot find symbol
|
||||
import org.hibernate.type.SqlTypes;
|
||||
^
|
||||
symbol: class SqlTypes
|
||||
location: package org.hibernate.type
|
||||
src/compat/NewAnnotations.java:6: error: cannot find symbol
|
||||
@SQLRestriction("deleted = false")
|
||||
^
|
||||
symbol: class SQLRestriction
|
||||
src/compat/NewAnnotations.java:9: error: cannot find symbol
|
||||
@JdbcTypeCode(SqlTypes.CHAR)
|
||||
^
|
||||
symbol: class JdbcTypeCode
|
||||
location: class NewAnnotations
|
||||
src/compat/NewAnnotations.java:9: error: cannot find symbol
|
||||
@JdbcTypeCode(SqlTypes.CHAR)
|
||||
^
|
||||
symbol: variable SqlTypes
|
||||
location: class NewAnnotations
|
||||
6 errors
|
||||
javac exit status: 1
|
||||
@@ -0,0 +1,2 @@
|
||||
Hibernate 7.4.14, compiling NewAnnotations.java
|
||||
javac exit status: 0
|
||||
@@ -0,0 +1,15 @@
|
||||
Hibernate 5.6.15, H2, @GeneratedValue with no strategy
|
||||
-- sequences (name, increment)
|
||||
HIBERNATE_SEQUENCE 1
|
||||
-- columns of PROBE (name, type)
|
||||
ACTIVE BOOLEAN
|
||||
BYNAME CHARACTER VARYING
|
||||
BYORDINAL INTEGER
|
||||
CREATEDAT TIMESTAMP
|
||||
ID BIGINT
|
||||
NAME CHARACTER VARYING
|
||||
OCCURREDAT TIMESTAMP
|
||||
PAYLOAD BINARY VARYING
|
||||
PRICE NUMERIC
|
||||
SPAN BIGINT
|
||||
UUID BINARY
|
||||
@@ -0,0 +1,15 @@
|
||||
Hibernate 7.4.14, H2, @GeneratedValue with no strategy
|
||||
-- sequences (name, increment)
|
||||
PROBE_SEQ 50
|
||||
-- columns of PROBE (name, type)
|
||||
ACTIVE BOOLEAN
|
||||
BYNAME ENUM
|
||||
BYORDINAL TINYINT
|
||||
CREATEDAT TIMESTAMP WITH TIME ZONE
|
||||
ID BIGINT
|
||||
NAME CHARACTER VARYING
|
||||
OCCURREDAT TIMESTAMP
|
||||
PAYLOAD BINARY VARYING
|
||||
PRICE NUMERIC
|
||||
SPAN NUMERIC
|
||||
UUID UUID
|
||||
@@ -0,0 +1,15 @@
|
||||
Hibernate 5.6.15 Hibernate 7.4.14
|
||||
-- id sequences (name, increment)
|
||||
HIBERNATE_SEQUENCE 1 PROBE_SEQ 50
|
||||
-- column types in H2
|
||||
ACTIVE BOOLEAN BOOLEAN (same)
|
||||
BYNAME CHARACTER VARYING ENUM <-- differs
|
||||
BYORDINAL INTEGER TINYINT <-- differs
|
||||
CREATEDAT TIMESTAMP TIMESTAMP WITH TIME ZONE <-- differs
|
||||
ID BIGINT BIGINT (same)
|
||||
NAME CHARACTER VARYING CHARACTER VARYING (same)
|
||||
OCCURREDAT TIMESTAMP TIMESTAMP (same)
|
||||
PAYLOAD BINARY VARYING BINARY VARYING (same)
|
||||
PRICE NUMERIC NUMERIC (same)
|
||||
SPAN BIGINT NUMERIC <-- differs
|
||||
UUID BINARY UUID <-- differs
|
||||
@@ -0,0 +1,6 @@
|
||||
Hibernate 5.6.15
|
||||
session.save(...) returned: 1 (Long)
|
||||
HQL with ?1 : 1 row(s)
|
||||
HQL with a bare ? : failed: IllegalArgumentException: org.hibernate.QueryException: Legacy-style query parameters (`?`) are no longer supported; use JPA-style ordinal parameters (e.g., `?1`) ins...
|
||||
HQL enum compared with 0 : 0 row(s)
|
||||
session.createCriteria(...) : 1 row(s)
|
||||
@@ -0,0 +1,5 @@
|
||||
Hibernate 7.4.14
|
||||
session.persist(...) assigned the id: 1 (Long)
|
||||
HQL with ?1 : 1 row(s)
|
||||
HQL with a bare ? : failed: IllegalArgumentException: org.hibernate.query.ParameterLabelException: Unlabeled ordinal parameter ('?' rather than ?1)
|
||||
HQL enum compared with 0 : 0 row(s)
|
||||
@@ -0,0 +1,3 @@
|
||||
Hibernate 7.4.14 opening the H2 file database written by Hibernate 5.6.15 (same Probe entity)
|
||||
hbm2ddl.auto=validate: failed: SchemaManagementException: Schema validation: wrong column type encountered in column [span] in table [Probe]; found [bigint (Types#BIGINT)], but expecting [numeric(21,0) (Types#NUMERIC)]
|
||||
hbm2ddl.auto=none : opened; loaded the row written by 5.6.15: name=legacy row, uuid=null
|
||||
@@ -0,0 +1,10 @@
|
||||
Hibernate 5.6.15, compiling JakartaNamespace.java
|
||||
src/compat/JakartaNamespace.java:1: error: package jakarta.persistence does not exist
|
||||
import jakarta.persistence.Entity;
|
||||
^
|
||||
src/compat/JakartaNamespace.java:3: error: cannot find symbol
|
||||
@Entity
|
||||
^
|
||||
symbol: class Entity
|
||||
2 errors
|
||||
javac exit status: 1
|
||||
@@ -0,0 +1,2 @@
|
||||
Hibernate 7.4.14, compiling JakartaNamespace.java
|
||||
javac exit status: 0
|
||||
@@ -0,0 +1,2 @@
|
||||
Hibernate 5.6.15, compiling JavaxNamespace.java
|
||||
javac exit status: 0
|
||||
@@ -0,0 +1,10 @@
|
||||
Hibernate 7.4.14, compiling JavaxNamespace.java
|
||||
src/compat/JavaxNamespace.java:1: error: package javax.persistence does not exist
|
||||
import javax.persistence.Entity;
|
||||
^
|
||||
src/compat/JavaxNamespace.java:3: error: cannot find symbol
|
||||
@Entity
|
||||
^
|
||||
symbol: class Entity
|
||||
2 errors
|
||||
javac exit status: 1
|
||||
@@ -0,0 +1,6 @@
|
||||
persist(a) -> id assigned on the object: 1
|
||||
find(Author, id) -> Ann (1 select)
|
||||
getReference(Author, id) -> initialized: false (0 selects)
|
||||
merge(detached) -> returns a different instance: true, name now Ann Smith
|
||||
findMultiple(ids 3) -> 3 entries, missing id gives: null
|
||||
remove(a) -> find afterwards: null
|
||||
@@ -0,0 +1,8 @@
|
||||
named parameter : [Beta]
|
||||
?1 parameter : [Alpha, Beta]
|
||||
limit 2 offset 1 in HQL : [Beta, Gamma]
|
||||
order by ... nulls last : [Beta, Alpha, Gamma]
|
||||
getSingleResultOrNull() : null
|
||||
join fetch : author initialized = true
|
||||
count over an association : 2
|
||||
createMutationQuery update: 2 rows
|
||||
@@ -0,0 +1,3 @@
|
||||
insert x3 (no persistence context) done
|
||||
get twice -> same instance: false (a stateless session has no first-level cache)
|
||||
rows in table: [3]
|
||||
@@ -0,0 +1,2 @@
|
||||
bySimpleNaturalId(...).load -> Ann
|
||||
sql: select a1_0.id,a1_0.email,a1_0.name from Author a1_0 where a1_0.email=?
|
||||
@@ -0,0 +1,3 @@
|
||||
remove(note) ran: update Note set deleted=true where id=? and deleted=false
|
||||
find afterwards : null
|
||||
row still in the table: [TRUE 1 remember]
|
||||
@@ -0,0 +1,2 @@
|
||||
loaded: Address[street=1 Main St, city=Pune]
|
||||
columns: [CITY, ID, NAME, STREET]
|
||||
Reference in New Issue
Block a user