Skip to content

Conversation

@gavinking
Copy link
Member

@gavinking gavinking commented Jan 5, 2025

Let's make the NodeBuilder the thing that is the SqmCreationContext, and introduce a new thing that performs a similar role for SqlAstCreationContext. The reason here is twofold:

  • it is part of my long struggle to decouple query parsing/typing from the SessionFactory, in order to make HibernateProcessor less of a hack and I guess more robust
  • SessionFactoryImplementor was already starting to be polluted with weird little operations that didn't belong there. That will only get worse with time.

[Please describe here what your change is about]


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.


https://hibernate.atlassian.net/browse/HHH-19010

@hibernate-github-bot
Copy link

hibernate-github-bot bot commented Jan 5, 2025

Thanks for your pull request!

This pull request does not follow the contribution rules. Could you have a look?

❌ All commit messages should start with a JIRA issue key matching pattern HHH-\d+
    ↳ Offending commits: [6eacabb, e1df901, 91785f4, f93d821]

› This message was automatically generated.

@gavinking gavinking changed the title get rid of inheritance of SessionFactoryImplementor from query creation context stuff HHH-19010 get rid of inheritance of SessionFactoryImplementor from query creation context stuff Jan 5, 2025
…ery creation context stuff

Let's make the NodeBuilder the thing that is the SqmCreationContext, and introduce a
new thing that performs a similar role for SqlAstCreationContext. The reason here is
twofold:

- it is part of my long struggle to decouple query parsing/typing from the
  SessionFactory, in order to make HibernateProcessor less of a hack and I
  guess more robust
- SessionFactoryImplementor was already starting to be polluted with weird
  little operations that didn't belong there. That will only get worse with
  time.
false,
true,
factory
converter.getCreationContext().getSessionFactory()

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
SqlAstCreationContext.getSessionFactory
should be avoided because it has been deprecated.
.buildSelectTranslator( converter.getCreationContext().getSessionFactory(), new SelectStatement( fakeQuery ) );
final SqlAstTranslator<JdbcOperationQuerySelect> translator =
creationContext.getDialect().getSqlAstTranslatorFactory()
.buildSelectTranslator( creationContext.getSessionFactory(), new SelectStatement( fakeQuery ) );

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
SqlAstCreationContext.getSessionFactory
should be avoided because it has been deprecated.
final JdbcEnvironment jdbcEnvironment = factory.getJdbcServices().getJdbcEnvironment();
//noinspection deprecation
return jdbcEnvironment.getQualifiedObjectNameFormatter();
return getJdbcEnvironment().getQualifiedObjectNameFormatter();

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
JdbcEnvironment.getQualifiedObjectNameFormatter
should be avoided because it has been deprecated.
canUseInnerJoins,
getFunctionRenderer().rendersIdentifierVariable( arguments, walker.getCreationContext().getSessionFactory() ),
getFunctionRenderer()
.rendersIdentifierVariable( arguments, walker.getCreationContext().getSessionFactory() ),

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
SqlAstCreationContext.getSessionFactory
should be avoided because it has been deprecated.
*/
default void validate(List<? extends SqmTypedNode<?>> arguments, String functionName, TypeConfiguration typeConfiguration) {}
default void validate(List<? extends SqmTypedNode<?>> arguments, String functionName, BindingContext bindingContext) {
validate( arguments, functionName, bindingContext.getTypeConfiguration() );

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
ArgumentsValidator.validate
should be avoided because it has been deprecated.
final SessionFactoryImplementor sessionFactory = creationContext.getSessionFactory();
final QueryEngine queryEngine = sessionFactory.getQueryEngine();
return queryEngine.getSqmFunctionRegistry().findFunctionDescriptor( "coalesce" )
final QueryEngine queryEngine = creationContext.getSessionFactory().getQueryEngine();

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
SqlAstCreationContext.getSessionFactory
should be avoided because it has been deprecated.
}

default WrapperOptions getWrapperOptions() {
return getSessionFactory().getWrapperOptions();

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
SqlAstCreationContext.getSessionFactory
should be avoided because it has been deprecated.
LoadQueryInfluencers getLoadQueryInfluencers();

default SqmCreationContext getSqmCreationContext() {
return getCreationContext().getSessionFactory().getQueryEngine().getCriteriaBuilder();

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
SqlAstCreationContext.getSessionFactory
should be avoided because it has been deprecated.
* Obtain the {@link SqmFunctionRegistry}.
*/
default SqmFunctionRegistry getSqmFunctionRegistry() {
return getSessionFactory().getQueryEngine().getSqmFunctionRegistry();

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
SqlAstCreationContext.getSessionFactory
should be avoided because it has been deprecated.
* Obtain the {@link Dialect}.
*/
default Dialect getDialect() {
return getSessionFactory().getQueryEngine().getDialect();

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
SqlAstCreationContext.getSessionFactory
should be avoided because it has been deprecated.
@gavinking gavinking merged commit da8a13b into hibernate:main Jan 5, 2025
24 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant