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

[3.16] Upgrade to Hibernate ORM 6.6.3.Final #44658

Open
wants to merge 5 commits into
base: 3.16
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,9 @@ private static DotName createConstant(String fqcn) {
createConstant("java.util.UUID"),
createConstant("java.lang.Void"));

public static final List<DotName> STANDARD_STACK_ELEMENT_TYPES = List.of(
createConstant("org.hibernate.query.sqm.tree.select.SqmQueryPart"));

public static final DotName HIBERNATE_ORM_PROCESSOR = createConstant(
"io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,14 @@ ReflectiveClassBuildItem registerJdbcArrayTypesForReflection() {
.build();
}

// Workaround for https://hibernate.atlassian.net/browse/HHH-18875
// See https://hibernate.zulipchat.com/#narrow/channel/132094-hibernate-orm-dev/topic/StandardStack.20and.20reflection
@BuildStep
ReflectiveClassBuildItem registerStandardStackElementTypesForReflection() {
return ReflectiveClassBuildItem
.builder(ClassNames.STANDARD_STACK_ELEMENT_TYPES.stream().map(d -> d.toString() + "[]").toArray(String[]::new))
.reason("Workaround for https://hibernate.atlassian.net/browse/HHH-18875")
.build();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.hibernate.bytecode.enhance.spi.DefaultEnhancementContext;
import org.hibernate.bytecode.enhance.spi.UnloadedField;
import org.hibernate.bytecode.enhance.spi.UnsupportedEnhancementStrategy;

public final class QuarkusEnhancementContext extends DefaultEnhancementContext {

Expand All @@ -26,4 +27,17 @@ public ClassLoader getLoadingClassLoader() {
throw new IllegalStateException("The Classloader of the EnhancementContext should not be used");
}

@Override
public UnsupportedEnhancementStrategy getUnsupportedEnhancementStrategy() {
// We expect model classes to be enhanced.
// Lack of enhancement could lead to many problems,
// from bad performance, to Quarkus-specific optimizations causing errors/data loss,
// to incorrect generated bytecode (references to non-existing methods).
// For backwards compatibility reason, in this branch we adopt the legacy behavior of Hibernate ORM,
// which is to try to enhance all classes, ignoring any known issue.
// However, later versions of Quarkus (3.17+ at least) just have Hibernate ORM's enhancer fail.
// with a clear error message pointing to the application class that needs to be fixed.
return UnsupportedEnhancementStrategy.LEGACY;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ public void testNoMissingHibernateAnnotation() {
}

private static void ignoreInternalAnnotations(Set<DotName> annotationSet) {
annotationSet.removeIf(name -> name.toString().equals("org.hibernate.cfg.Compatibility"));
annotationSet.removeIf(name -> name.toString().equals("org.hibernate.cfg.Unsafe"));
annotationSet.removeIf(name -> name.toString().equals("org.hibernate.Incubating"));
annotationSet.removeIf(name -> name.toString().equals("org.hibernate.Internal"));
annotationSet.removeIf(name -> name.toString().equals("org.hibernate.Remove"));
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<jacoco.version>0.8.12</jacoco.version>
<kubernetes-client.version>6.13.4</kubernetes-client.version> <!-- Please check with Java Operator SDK team before updating -->
<rest-assured.version>5.5.0</rest-assured.version>
<hibernate-orm.version>6.6.1.Final</hibernate-orm.version> <!-- WARNING when updating, also align the versions below -->
<hibernate-orm.version>6.6.3.Final</hibernate-orm.version> <!-- WARNING when updating, also align the versions below -->
<antlr.version>4.13.0</antlr.version> <!-- version controlled by Hibernate ORM's needs -->
<bytebuddy.version>1.14.18</bytebuddy.version> <!-- version controlled by Hibernate ORM's needs -->
<hibernate-commons-annotations.version>7.0.3.Final</hibernate-commons-annotations.version> <!-- version controlled by Hibernate ORM's needs -->
Expand Down
Loading