HHH-13715 - working support for "multi-table" HQL/Criteria UPDATE and DELETE queries;

work on CTE-base multi-table handling
This commit is contained in:
Steve Ebersole 2019-11-11 17:35:46 -06:00
parent 169646875b
commit d38c163f3a
2 changed files with 13 additions and 14 deletions

View File

@ -6220,8 +6220,7 @@ public abstract class AbstractEntityPersister
return SqmMutationStrategyHelper.resolveStrategy( return SqmMutationStrategyHelper.resolveStrategy(
entityBootDescriptor, entityBootDescriptor,
entityMappingDescriptor, entityMappingDescriptor,
creationProcess.getCreationContext().getSessionFactory().getSessionFactoryOptions() , creationProcess.getCreationContext()
creationProcess.getCreationContext().getSessionFactory().getServiceRegistry()
); );
} }

View File

@ -14,7 +14,8 @@ import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment;
import org.hibernate.engine.jdbc.spi.JdbcServices; import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.mapping.RootClass; import org.hibernate.mapping.RootClass;
import org.hibernate.persister.entity.EntityPersister; import org.hibernate.metamodel.mapping.EntityMappingType;
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
import org.hibernate.query.spi.QueryEngine; import org.hibernate.query.spi.QueryEngine;
import org.hibernate.query.spi.QueryParameterImplementor; import org.hibernate.query.spi.QueryParameterImplementor;
import org.hibernate.query.sqm.internal.DomainParameterXref; import org.hibernate.query.sqm.internal.DomainParameterXref;
@ -40,7 +41,6 @@ import org.hibernate.query.sqm.tree.predicate.SqmPredicate;
import org.hibernate.query.sqm.tree.select.SqmQuerySpec; import org.hibernate.query.sqm.tree.select.SqmQuerySpec;
import org.hibernate.query.sqm.tree.select.SqmSelectStatement; import org.hibernate.query.sqm.tree.select.SqmSelectStatement;
import org.hibernate.query.sqm.tree.update.SqmUpdateStatement; import org.hibernate.query.sqm.tree.update.SqmUpdateStatement;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.sql.ast.SqlAstTranslatorFactory; import org.hibernate.sql.ast.SqlAstTranslatorFactory;
import org.hibernate.sql.exec.spi.ExecutionContext; import org.hibernate.sql.exec.spi.ExecutionContext;
import org.hibernate.sql.exec.spi.JdbcParameter; import org.hibernate.sql.exec.spi.JdbcParameter;
@ -64,20 +64,20 @@ public class SqmMutationStrategyHelper {
* entity hierarchy. * entity hierarchy.
*/ */
public static SqmMultiTableMutationStrategy resolveStrategy( public static SqmMultiTableMutationStrategy resolveStrategy(
RootClass bootEntityDescriptor, RootClass entityBootDescriptor,
EntityPersister runtimeRootEntityDescriptor, EntityMappingType rootEntityDescriptor,
SessionFactoryOptions options, RuntimeModelCreationContext creationContext) {
ServiceRegistry serviceRegistry) { final SessionFactoryImplementor sessionFactory = creationContext.getSessionFactory();
// todo (6.0) : Planned support for per-entity config final SessionFactoryOptions options = sessionFactory.getSessionFactoryOptions();
final SqmMultiTableMutationStrategy specifiedStrategy = options.getSqmMultiTableMutationStrategy();
if ( options.getSqmMultiTableMutationStrategy() != null ) { if ( specifiedStrategy != null ) {
return options.getSqmMultiTableMutationStrategy(); return specifiedStrategy;
} }
return serviceRegistry.getService( JdbcServices.class ) return sessionFactory.getServiceRegistry().getService( JdbcServices.class )
.getJdbcEnvironment() .getJdbcEnvironment()
.getDialect() .getDialect()
.getFallbackSqmMutationStrategy( runtimeRootEntityDescriptor, ); .getFallbackSqmMutationStrategy( rootEntityDescriptor, creationContext );
} }
/** /**