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

4.x: Upgrade hibernate, eclipselink and microprofile config #7424

Closed
wants to merge 1 commit into from

Conversation

barchetta
Copy link
Member

Description

Upgrades:

Hibernate to 6.2.7.Final (Java 21 support, Jandex 3 support)
Hibernate Validator to 8.0.1.Final
EclipseLink to 4.0.2 (ASM 9.5 for Java 21 support)
MicroProfile Config to 3.0.3 (resolves WARNING] unknown enum constant org.osgi.annotation.bundle.Requirement.Resolution.OPTIONAL)

There is currently an issue where examples/integrations/cdi/pokemons fails at runtime at sql initialization time with:

org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl handleException
WARN: GenerationTarget encountered exception accepting command :
 Error executing DDL "INSERT INTO POKEMON VALUES (6, 'Pidgey', 3)" via 
JDBC [Data conversion error converting "'Pidgey' (POKEMON: ""POKEMONTYPE_ID"" INTEGER)";]
org.hibernate.tool.schema.spi.CommandAcceptanceException: 
Error executing DDL "INSERT INTO POKEMON VALUES (6, 'Pidgey', 3)" via
 JDBC [Data conversion error converting "'Pidgey' (POKEMON: ""POKEMONTYPE_ID"" INTEGER)";]
. . .
Caused by: org.h2.jdbc.JdbcSQLDataException: Data conversion error converting "'Pidgey' (POKEMON: ""POKEMONTYPE_ID"" INTEGER)"; SQL statement:
INSERT INTO POKEMON VALUES (6, 'Pidgey', 3) [22018-220]
	at org.h2.message.DbException.getJdbcSQLException(DbException.java:518)
. . .
Caused by: org.h2.message.DbException: Data conversion error converting "Pidgey" [22018-220]
	at org.h2.message.DbException.get(DbException.java:212)
. . .
Caused by: org.h2.jdbc.JdbcSQLDataException: Data conversion error converting "Pidgey" [22018-220]
	at org.h2.message.DbException.getJdbcSQLException(DbException.java:518)
. . .
Caused by: java.lang.NumberFormatException: For input string: "Pidgey"
	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
	at java.base/java.lang.Integer.parseInt(Integer.java:661)
	at java.base/java.lang.Integer.parseInt(Integer.java:777)
	at org.h2.value.ValueStringBase.getInt(ValueStringBase.java:131)

Documentation

No impact

@barchetta barchetta added jpa/jta dependencies Pull requests that update a dependency file 4.x Version 4.x labels Aug 23, 2023
@barchetta barchetta added this to the 4.0.0-M2 milestone Aug 23, 2023
@barchetta barchetta requested review from ljnelson and tvallin August 23, 2023 03:33
@barchetta barchetta self-assigned this Aug 23, 2023
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Aug 23, 2023
@barchetta barchetta requested a review from tjquinno August 23, 2023 03:34
@tvallin
Copy link
Member

tvallin commented Aug 23, 2023

I did some work to update Hibernate version here #7426

This PR contains a fix to examples/integrations/cdi/pokemons issue you mentioned.

@ljnelson
Copy link
Member

I'm looking at https://hibernate.atlassian.net/browse/HHH-16943 and https://hibernate.atlassian.net/browse/HHH-17065: it seems clear that Hibernate decided to overhaul a lot of things in the area of DDL between 6.1.7.Final and 6.2.7.Final. The changes between these two tags are…well, there are a LOT of them: hibernate/hibernate-orm@6.1.7...6.2.7

@ljnelson
Copy link
Member

ljnelson commented Aug 23, 2023

I am 99% sure this is going to be the culprit: https://github.com/hibernate/hibernate-orm/blob/6.2.7/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java#L876-L894

Briefly, it looks like Hibernate introduced a hibernate.column_ordering_strategy setting that is, by default, set to standard, which means this guy will be in the mix: https://github.com/hibernate/hibernate-orm/blob/6.2.7/hibernate-core/src/main/java/org/hibernate/boot/model/relational/ColumnOrderingStrategyStandard.java

Note that the legacy strategy (what we're used to) does nothing (note the null returns signaling, apparently, no reordering taking place): https://github.com/hibernate/hibernate-orm/blob/6.2.7/hibernate-core/src/main/java/org/hibernate/boot/model/relational/ColumnOrderingStrategyLegacy.java

At any rate, I'm going to guess that setting hibernate.column_ordering_strategy = legacy in hibernate.properties or as a persistence.xml property will restore the prior behavior.

@barchetta
Copy link
Member Author

Upgraded microprofile config in #7434 and eclipse link in #7435

Upgrading hibernate has additional complications

@barchetta barchetta closed this Aug 23, 2023
@barchetta barchetta deleted the 4.x-upgrade-hibernate branch January 11, 2024 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.x Version 4.x dependencies Pull requests that update a dependency file jpa/jta OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants