use of org.hibernate.query.sqm.internal.SqmCreationOptionsStandard in project hibernate-orm by hibernate.
the class QueryEngine method from.
public static QueryEngine from(SessionFactoryImplementor sessionFactory, MetadataImplementor metadata) {
final QueryEngineOptions queryEngineOptions = sessionFactory.getSessionFactoryOptions();
final SqmCreationOptions sqmCreationOptions = new SqmCreationOptionsStandard(sessionFactory);
final Dialect dialect = sessionFactory.getJdbcServices().getDialect();
final HqlTranslator hqlTranslator = resolveHqlTranslator(queryEngineOptions, dialect, sessionFactory, sqmCreationOptions);
final SqmTranslatorFactory sqmTranslatorFactory = resolveSqmTranslatorFactory(queryEngineOptions, dialect);
final SqmFunctionRegistry customSqmFunctionRegistry;
if (queryEngineOptions.getCustomSqmFunctionRegistry() == null) {
final Map<String, SqmFunctionDescriptor> customSqlFunctionMap = queryEngineOptions.getCustomSqlFunctionMap();
if (customSqlFunctionMap == null || customSqlFunctionMap.isEmpty()) {
customSqmFunctionRegistry = null;
} else {
customSqmFunctionRegistry = new SqmFunctionRegistry();
customSqlFunctionMap.forEach(customSqmFunctionRegistry::register);
}
} else {
customSqmFunctionRegistry = queryEngineOptions.getCustomSqmFunctionRegistry();
}
return new QueryEngine(sessionFactory.getUuid(), sessionFactory.getName(), sessionFactory.getSessionFactoryOptions().getJpaCompliance(), () -> sessionFactory.getRuntimeMetamodels().getJpaMetamodel(), sessionFactory.getSessionFactoryOptions().getCriteriaValueHandlingMode(), sessionFactory.getSessionFactoryOptions().getPreferredSqlTypeCodeForBoolean(), metadata.buildNamedQueryRepository(sessionFactory), hqlTranslator, sqmTranslatorFactory, sessionFactory.getServiceRegistry().getService(NativeQueryInterpreter.class), buildInterpretationCache(sessionFactory::getStatistics, sessionFactory.getProperties()), metadata.getTypeConfiguration(), dialect, customSqmFunctionRegistry, sessionFactory.getServiceRegistry());
}
Aggregations