diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java b/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java index 4aebf8ace0..26c59f3355 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java @@ -736,6 +736,13 @@ public interface AvailableSettings extends org.hibernate.jpa.AvailableSettings { */ String USE_SQL_COMMENTS ="hibernate.use_sql_comments"; + /** + * Enable logging of functions registered by the + * {@linkplain AvailableSettings#DIALECT configured} + * SQL {@link org.hibernate.dialect.Dialect}. + */ + String SHOW_HQL_FUNCTIONS = "hibernate.dialect.show_hql_functions"; + /** * Maximum depth of outer join fetching */ diff --git a/hibernate-core/src/main/java/org/hibernate/query/spi/QueryEngine.java b/hibernate-core/src/main/java/org/hibernate/query/spi/QueryEngine.java index b90dfb2d28..2191845687 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/spi/QueryEngine.java +++ b/hibernate-core/src/main/java/org/hibernate/query/spi/QueryEngine.java @@ -111,6 +111,17 @@ public class QueryEngine { if ( userDefinedRegistry != null ) { userDefinedRegistry.overlay( sqmFunctionRegistry ); } + + final boolean showSQLFunctions = ConfigurationHelper.getBoolean( + AvailableSettings.SHOW_HQL_FUNCTIONS, + serviceRegistry.getService( ConfigurationService.class ).getSettings(), + false + ); + if ( showSQLFunctions ) { + sqmFunctionRegistry.getFunctionsByName().forEach( + entry -> System.out.println( entry.getValue().getSignature( entry.getKey() ) ) + ); + } } /**