remove hibernate.dialect.show_hql_functions and just make it a log category
really unclear why I didn't do it that way in the first place
This commit is contained in:
parent
0b96d8fca7
commit
c96f22dfe0
|
@ -1075,6 +1075,12 @@ Registering a function isn't hard, but is beyond the scope of this chapter.
|
||||||
|
|
||||||
Fortunately, every built-in `Dialect` already registers many native functions for the database it supports.
|
Fortunately, every built-in `Dialect` already registers many native functions for the database it supports.
|
||||||
|
|
||||||
|
[TIP]
|
||||||
|
====
|
||||||
|
Try setting the log category `org.hibernate.HQL_FUNCTIONS` to debug.
|
||||||
|
Then at startup Hibernate will log a list of type signatures of all registered functions.
|
||||||
|
====
|
||||||
|
|
||||||
[[hql-var-function-example]]
|
[[hql-var-function-example]]
|
||||||
====
|
====
|
||||||
[source, JAVA, indent=0]
|
[source, JAVA, indent=0]
|
||||||
|
|
|
@ -777,13 +777,6 @@ public interface AvailableSettings {
|
||||||
*/
|
*/
|
||||||
String USE_SQL_COMMENTS ="hibernate.use_sql_comments";
|
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
|
* Maximum depth of outer join fetching
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -56,7 +56,7 @@ import org.jboss.logging.Logger;
|
||||||
*/
|
*/
|
||||||
@Incubating
|
@Incubating
|
||||||
public class QueryEngine {
|
public class QueryEngine {
|
||||||
private static final Logger LOG_HQL_FUNCTIONS = CoreLogging.logger( "org.hibernate.LOG_HQL_FUNCTIONS" );
|
private static final Logger LOG_HQL_FUNCTIONS = CoreLogging.logger( "org.hibernate.HQL_FUNCTIONS" );
|
||||||
|
|
||||||
public static QueryEngine from(SessionFactoryImplementor sessionFactory, MetadataImplementor metadata) {
|
public static QueryEngine from(SessionFactoryImplementor sessionFactory, MetadataImplementor metadata) {
|
||||||
final QueryEngineOptions queryEngineOptions = sessionFactory.getSessionFactoryOptions();
|
final QueryEngineOptions queryEngineOptions = sessionFactory.getSessionFactoryOptions();
|
||||||
|
@ -175,14 +175,9 @@ public class QueryEngine {
|
||||||
contributor.contributeFunctions( functionContributions );
|
contributor.contributeFunctions( functionContributions );
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean showSQLFunctions = ConfigurationHelper.getBoolean(
|
if ( LOG_HQL_FUNCTIONS.isDebugEnabled() ) {
|
||||||
AvailableSettings.SHOW_HQL_FUNCTIONS,
|
|
||||||
serviceRegistry.getService( ConfigurationService.class ).getSettings(),
|
|
||||||
false
|
|
||||||
);
|
|
||||||
if ( showSQLFunctions && LOG_HQL_FUNCTIONS.isInfoEnabled() ) {
|
|
||||||
sqmFunctionRegistry.getFunctionsByName().forEach(
|
sqmFunctionRegistry.getFunctionsByName().forEach(
|
||||||
entry -> LOG_HQL_FUNCTIONS.info( entry.getValue().getSignature( entry.getKey() ) )
|
entry -> LOG_HQL_FUNCTIONS.debug( entry.getValue().getSignature( entry.getKey() ) )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,7 +128,10 @@ logger.cache.level=trace
|
||||||
logger.stat.name=org.hibernate.stat
|
logger.stat.name=org.hibernate.stat
|
||||||
logger.stat.level=trace
|
logger.stat.level=trace
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
## Log a list of functions registered by the Dialect
|
||||||
|
|
||||||
|
org.hibernate.HQL_FUNCTIONS=info
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
## Hibernate's JUnit extensions (hibernate-testing)
|
## Hibernate's JUnit extensions (hibernate-testing)
|
||||||
|
|
Loading…
Reference in New Issue