Add hibernate.dialect.show_hql_functions
Very useful feature for logging available functions
This commit is contained in:
parent
96c948b06b
commit
f0d93200b5
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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() ) )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue