diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/AbstractTransactSQLDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/AbstractTransactSQLDialect.java index dc3e42adb3..6cae7c7fde 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/AbstractTransactSQLDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/AbstractTransactSQLDialect.java @@ -12,7 +12,7 @@ import org.hibernate.query.NullOrdering; import org.hibernate.boot.TempTableDdlTransactionHandling; import org.hibernate.cfg.Environment; import org.hibernate.dialect.function.CommonFunctionFactory; -import org.hibernate.dialect.function.IndividualLeastGreatestEmulation; +import org.hibernate.dialect.function.CaseLeastGreatestEmulation; import org.hibernate.dialect.identity.AbstractTransactSQLIdentityColumnSupport; import org.hibernate.dialect.identity.IdentityColumnSupport; import org.hibernate.metamodel.mapping.EntityMappingType; @@ -113,8 +113,8 @@ abstract class AbstractTransactSQLDialect extends Dialect { CommonFunctionFactory.datepartDatename( queryEngine ); CommonFunctionFactory.lastDay_eomonth( queryEngine ); - queryEngine.getSqmFunctionRegistry().register( "least", new IndividualLeastGreatestEmulation( true ) ); - queryEngine.getSqmFunctionRegistry().register( "greatest", new IndividualLeastGreatestEmulation( false ) ); + queryEngine.getSqmFunctionRegistry().register( "least", new CaseLeastGreatestEmulation( true ) ); + queryEngine.getSqmFunctionRegistry().register( "greatest", new CaseLeastGreatestEmulation( false ) ); } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/DerbyDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/DerbyDialect.java index 8b4f8f159c..073b73e20e 100755 --- a/hibernate-core/src/main/java/org/hibernate/dialect/DerbyDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/DerbyDialect.java @@ -11,9 +11,9 @@ import org.hibernate.NotYetImplementedFor6Exception; import org.hibernate.boot.TempTableDdlTransactionHandling; import org.hibernate.cfg.Environment; import org.hibernate.dialect.function.CommonFunctionFactory; -import org.hibernate.dialect.function.DerbyLpadFunction; -import org.hibernate.dialect.function.DerbyRpadFunction; -import org.hibernate.dialect.function.IndividualLeastGreatestEmulation; +import org.hibernate.dialect.function.DerbyLpadEmulation; +import org.hibernate.dialect.function.DerbyRpadEmulation; +import org.hibernate.dialect.function.CaseLeastGreatestEmulation; import org.hibernate.dialect.function.InsertSubstringOverlayEmulation; import org.hibernate.dialect.identity.DB2IdentityColumnSupport; import org.hibernate.dialect.identity.IdentityColumnSupport; @@ -207,10 +207,10 @@ public class DerbyDialect extends Dialect { .register(); //no way I can see to pad with anything other than spaces - queryEngine.getSqmFunctionRegistry().register( "lpad", new DerbyLpadFunction() ); - queryEngine.getSqmFunctionRegistry().register( "rpad", new DerbyRpadFunction() ); - queryEngine.getSqmFunctionRegistry().register( "least", new IndividualLeastGreatestEmulation( true ) ); - queryEngine.getSqmFunctionRegistry().register( "greatest", new IndividualLeastGreatestEmulation( false ) ); + queryEngine.getSqmFunctionRegistry().register( "lpad", new DerbyLpadEmulation() ); + queryEngine.getSqmFunctionRegistry().register( "rpad", new DerbyRpadEmulation() ); + queryEngine.getSqmFunctionRegistry().register( "least", new CaseLeastGreatestEmulation( true ) ); + queryEngine.getSqmFunctionRegistry().register( "greatest", new CaseLeastGreatestEmulation( false ) ); queryEngine.getSqmFunctionRegistry().register( "overlay", new InsertSubstringOverlayEmulation( true ) ); } diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/InformixDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/InformixDialect.java index 22c0313374..1e5a7e4c3e 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/InformixDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/InformixDialect.java @@ -8,8 +8,7 @@ package org.hibernate.dialect; import org.hibernate.boot.TempTableDdlTransactionHandling; import org.hibernate.dialect.function.CommonFunctionFactory; -import org.hibernate.dialect.function.CurrentFunction; -import org.hibernate.dialect.function.IndividualLeastGreatestEmulation; +import org.hibernate.dialect.function.CaseLeastGreatestEmulation; import org.hibernate.dialect.identity.IdentityColumnSupport; import org.hibernate.dialect.identity.InformixIdentityColumnSupport; import org.hibernate.dialect.pagination.FirstLimitHandler; @@ -162,8 +161,8 @@ public class InformixDialect extends Dialect { //coalesce() and nullif() both supported since Informix 12 - queryEngine.getSqmFunctionRegistry().register( "least", new IndividualLeastGreatestEmulation( true ) ); - queryEngine.getSqmFunctionRegistry().register( "greatest", new IndividualLeastGreatestEmulation( false ) ); + queryEngine.getSqmFunctionRegistry().register( "least", new CaseLeastGreatestEmulation( true ) ); + queryEngine.getSqmFunctionRegistry().register( "greatest", new CaseLeastGreatestEmulation( false ) ); } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/SQLServerDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/SQLServerDialect.java index c9af94c2c2..f446253b6f 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/SQLServerDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/SQLServerDialect.java @@ -8,7 +8,7 @@ package org.hibernate.dialect; import org.hibernate.*; import org.hibernate.dialect.function.CommonFunctionFactory; -import org.hibernate.dialect.function.SQLServerFormatFunction; +import org.hibernate.dialect.function.SQLServerFormatEmulation; import org.hibernate.dialect.identity.IdentityColumnSupport; import org.hibernate.dialect.identity.SQLServerIdentityColumnSupport; import org.hibernate.dialect.pagination.LimitHandler; @@ -149,7 +149,7 @@ public class SQLServerDialect extends AbstractTransactSQLDialect { } if ( getVersion() >= 11 ) { - queryEngine.getSqmFunctionRegistry().register( "format", new SQLServerFormatFunction( this ) ); + queryEngine.getSqmFunctionRegistry().register( "format", new SQLServerFormatEmulation( this ) ); //actually translate() was added in 2017 but //it's not worth adding a new dialect for that! diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/function/IndividualLeastGreatestEmulation.java b/hibernate-core/src/main/java/org/hibernate/dialect/function/CaseLeastGreatestEmulation.java similarity index 95% rename from hibernate-core/src/main/java/org/hibernate/dialect/function/IndividualLeastGreatestEmulation.java rename to hibernate-core/src/main/java/org/hibernate/dialect/function/CaseLeastGreatestEmulation.java index 7347c63f6e..6f10f37884 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/function/IndividualLeastGreatestEmulation.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/function/CaseLeastGreatestEmulation.java @@ -19,12 +19,12 @@ import org.hibernate.sql.ast.tree.SqlAstNode; * * @author Christian Beikov */ -public class IndividualLeastGreatestEmulation +public class CaseLeastGreatestEmulation extends AbstractSqmSelfRenderingFunctionDescriptor { private final String operator; - public IndividualLeastGreatestEmulation(boolean least) { + public CaseLeastGreatestEmulation(boolean least) { super( least ? "least" : "greatest", StandardArgumentsValidators.min( 2 ), diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/function/DerbyLpadFunction.java b/hibernate-core/src/main/java/org/hibernate/dialect/function/DerbyLpadEmulation.java similarity index 97% rename from hibernate-core/src/main/java/org/hibernate/dialect/function/DerbyLpadFunction.java rename to hibernate-core/src/main/java/org/hibernate/dialect/function/DerbyLpadEmulation.java index d31ad8af80..10ac541bca 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/function/DerbyLpadFunction.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/function/DerbyLpadEmulation.java @@ -22,10 +22,10 @@ import org.hibernate.type.StandardBasicTypes; * * @author Christian Beikov */ -public class DerbyLpadFunction +public class DerbyLpadEmulation extends AbstractSqmSelfRenderingFunctionDescriptor { - public DerbyLpadFunction() { + public DerbyLpadEmulation() { super( "lpad", StandardArgumentsValidators.exactly( 2 ), diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/function/DerbyRpadFunction.java b/hibernate-core/src/main/java/org/hibernate/dialect/function/DerbyRpadEmulation.java similarity index 97% rename from hibernate-core/src/main/java/org/hibernate/dialect/function/DerbyRpadFunction.java rename to hibernate-core/src/main/java/org/hibernate/dialect/function/DerbyRpadEmulation.java index c721a5dcae..874a2d724f 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/function/DerbyRpadFunction.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/function/DerbyRpadEmulation.java @@ -22,10 +22,10 @@ import org.hibernate.type.StandardBasicTypes; * * @author Christian Beikov */ -public class DerbyRpadFunction +public class DerbyRpadEmulation extends AbstractSqmSelfRenderingFunctionDescriptor { - public DerbyRpadFunction() { + public DerbyRpadEmulation() { super( "rpad", StandardArgumentsValidators.exactly( 2 ), diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/function/SQLServerFormatFunction.java b/hibernate-core/src/main/java/org/hibernate/dialect/function/SQLServerFormatEmulation.java similarity index 93% rename from hibernate-core/src/main/java/org/hibernate/dialect/function/SQLServerFormatFunction.java rename to hibernate-core/src/main/java/org/hibernate/dialect/function/SQLServerFormatEmulation.java index 1be168a3fc..c10e5a09c7 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/function/SQLServerFormatFunction.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/function/SQLServerFormatEmulation.java @@ -26,11 +26,11 @@ import org.hibernate.type.spi.TypeConfiguration; * * @author Christian Beikov */ -public class SQLServerFormatFunction extends AbstractSqmSelfRenderingFunctionDescriptor { +public class SQLServerFormatEmulation extends AbstractSqmSelfRenderingFunctionDescriptor { private final SQLServerDialect dialect; - public SQLServerFormatFunction(SQLServerDialect dialect) { + public SQLServerFormatEmulation(SQLServerDialect dialect) { super( "format", StandardArgumentsValidators.exactly( 2 ),