diff --git a/ci/jpa-3.2-tck.Jenkinsfile b/ci/jpa-3.2-tck.Jenkinsfile index bcf669e2ba4e..9f380728859a 100644 --- a/ci/jpa-3.2-tck.Jenkinsfile +++ b/ci/jpa-3.2-tck.Jenkinsfile @@ -24,9 +24,9 @@ pipeline { } parameters { choice(name: 'IMAGE_JDK', choices: ['jdk17', 'jdk25'], description: 'The JDK base image version to use for the TCK image.') - string(name: 'TCK_VERSION', defaultValue: '3.2.0', description: 'The version of the Jakarta JPA TCK i.e. `2.2.0` or `3.0.1`') - string(name: 'TCK_SHA', defaultValue: '', description: 'The SHA256 of the Jakarta JPA TCK that is distributed under https://download.eclipse.org/jakartaee/persistence/3.1/jakarta-persistence-tck-${TCK_VERSION}.zip.sha256') - string(name: 'TCK_URL', defaultValue: 'https://www.eclipse.org/downloads/download.php?file=/ee4j/jakartaee-tck/jakartaee11/staged/eftl/jakarta-persistence-tck-3.2.0.zip&mirror_id=1', description: 'The URL from which to download the TCK ZIP file. Only needed for testing staged builds. Ensure the TCK_VERSION variable matches the ZIP file name suffix.') + string(name: 'TCK_VERSION', defaultValue: '3.2.1', description: 'The version of the Jakarta JPA TCK i.e. `2.2.0` or `3.0.1`') + string(name: 'TCK_SHA', defaultValue: '1d282675f43fa13cf8ab2537d6dbfb1e1c95f7b838ab7cdd053e185c363a6519', description: 'The SHA256 of the Jakarta JPA TCK that is distributed under https://download.eclipse.org/jakartaee/persistence/3.1/jakarta-persistence-tck-${TCK_VERSION}.zip.sha256') + string(name: 'TCK_URL', defaultValue: 'https://download.eclipse.org/jakartaee/persistence/3.2/jakarta-persistence-tck-3.2.1.zip', description: 'The URL from which to download the TCK ZIP file. Only needed for testing staged builds. Ensure the TCK_VERSION variable matches the ZIP file name suffix.') choice(name: 'RDBMS', choices: ['postgresql','mysql','mssql','oracle','db2','sybase'], description: 'The JDK base image version to use for the TCK image.') } stages { @@ -37,7 +37,7 @@ pipeline { } stage('TCK') { agent { - label 'LongDuration' + label 'Worker&&Containers' } stages { stage('Build') { diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/jpa/ParameterCollector.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/jpa/ParameterCollector.java index 06daf6d19313..2fac47c1da8f 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/jpa/ParameterCollector.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/jpa/ParameterCollector.java @@ -10,6 +10,7 @@ import java.util.function.Consumer; import org.checkerframework.checker.nullness.qual.Nullable; +import org.hibernate.query.sqm.tree.expression.SqmBinaryArithmetic; import org.hibernate.type.BindableType; import org.hibernate.query.sqm.SqmBindableType; import org.hibernate.query.sqm.SqmPathSource; @@ -316,6 +317,13 @@ public Object visitIsTruePredicate(SqmTruthnessPredicate predicate) { return predicate; } + @Override + public Object visitBinaryArithmeticExpression(SqmBinaryArithmetic expression) { + withTypeInference( expression.getRightHandOperand(), expression.getLeftHandOperand() ); + withTypeInference( expression.getLeftHandOperand(), expression.getRightHandOperand() ); + return expression; + } + @Override public Object visitComparisonPredicate(SqmComparisonPredicate predicate) { withTypeInference( predicate.getRightHandExpression(), predicate.getLeftHandExpression() ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/criteria/CriteriaTypeValidationTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/criteria/CriteriaTypeValidationTests.java index accfa93466c9..5a90e7550838 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/criteria/CriteriaTypeValidationTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/criteria/CriteriaTypeValidationTests.java @@ -53,6 +53,20 @@ public void testHhh17001(SessionFactoryScope scope) { ); } + @Test + @JiraKey( "HHH-20313" ) + public void testCompareDoubleToInteger(SessionFactoryScope scope) { + scope.inTransaction( + session -> { + final HibernateCriteriaBuilder cb = session.getCriteriaBuilder(); + final CriteriaQuery cq = cb.createQuery(Parent.class); + final Root root = cq.from(Parent.class); + cq.where( cb.lt( root.get( "price" ), cb.prod( cb.literal( 54 ), 2 ) ) ); + session.createQuery(cq).getResultList(); + } + ); + } + @Entity(name = "Parent") public static class Parent { @@ -60,6 +74,7 @@ public static class Parent { private Long id; private String name; + private Double price; @OneToMany(mappedBy = "parent", fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true) private Set children = new HashSet<>(); diff --git a/hibernate-testing/src/main/java/org/hibernate/testing/bytecode/enhancement/extension/engine/BytecodeEnhancedTestEngine.java b/hibernate-testing/src/main/java/org/hibernate/testing/bytecode/enhancement/extension/engine/BytecodeEnhancedTestEngine.java index be6692912152..d849b558a80c 100644 --- a/hibernate-testing/src/main/java/org/hibernate/testing/bytecode/enhancement/extension/engine/BytecodeEnhancedTestEngine.java +++ b/hibernate-testing/src/main/java/org/hibernate/testing/bytecode/enhancement/extension/engine/BytecodeEnhancedTestEngine.java @@ -57,11 +57,25 @@ import org.junit.platform.engine.support.hierarchical.EngineExecutionContext; import org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine; import org.junit.platform.engine.support.hierarchical.ThrowableCollector; +import org.junit.platform.engine.support.store.NamespacedHierarchicalStore; public class BytecodeEnhancedTestEngine extends HierarchicalTestEngine { + private static final Class LAUNCHER_STORE_FACADE_BEFORE_JUNIT_5_14; public static final String ENHANCEMENT_EXTENSION_ENGINE_ENABLED = "hibernate.testing.bytecode.enhancement.extension.engine.enabled"; + static { + Class launcherStoreFacadeBeforeJunit514 = null; + try { + // The class was moved to a different package in 5.14 + launcherStoreFacadeBeforeJunit514 = Class.forName( "org.junit.jupiter.engine.descriptor.LauncherStoreFacade" ); + } + catch (ClassNotFoundException e) { + // ignore + } + LAUNCHER_STORE_FACADE_BEFORE_JUNIT_5_14 = launcherStoreFacadeBeforeJunit514; + } + public static boolean isEnabled() { return "true".equalsIgnoreCase( System.getProperty( ENHANCEMENT_EXTENSION_ENGINE_ENABLED, "false" ) ); } @@ -264,6 +278,24 @@ protected JupiterEngineExecutionContext createExecutionContext(ExecutionRequest catch (NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException e) { // Ignore errors as they are probably due to version mismatches and try the 5.13 way } + if ( LAUNCHER_STORE_FACADE_BEFORE_JUNIT_5_14 != null ) { + try { + // Try constructing the JupiterEngineExecutionContext the way it was done in 5.13 and before + final Constructor constructorV5_12 = JupiterEngineExecutionContext.class + .getConstructor( EngineExecutionListener.class, JupiterConfiguration.class, LAUNCHER_STORE_FACADE_BEFORE_JUNIT_5_14 ); + final Constructor launcherStoreFacadeConstructor = + LAUNCHER_STORE_FACADE_BEFORE_JUNIT_5_14.getConstructor( NamespacedHierarchicalStore.class ); + return constructorV5_12.newInstance( + request.getEngineExecutionListener(), + this.getJupiterConfiguration( request ), + launcherStoreFacadeConstructor.newInstance( request.getStore() ) + ); + } + catch (NoSuchMethodException | InstantiationException | IllegalAccessException | + InvocationTargetException e) { + // Ignore errors as they are probably due to version mismatches and try the 5.13 way + } + } return new JupiterEngineExecutionContext( request.getEngineExecutionListener(),