HHH-17162 - Allow short names for insert strategies

Signed-off-by: Jan Schatteman <jschatte@redhat.com>
This commit is contained in:
Jan Schatteman 2023-10-20 21:43:59 +02:00 committed by Steve Ebersole
parent 905108e5b3
commit 2c9ce29600
1 changed files with 29 additions and 0 deletions

View File

@ -33,10 +33,15 @@ import org.hibernate.id.enhanced.ImplicitDatabaseObjectNamingStrategy;
import org.hibernate.id.enhanced.SingleNamingStrategy;
import org.hibernate.id.enhanced.LegacyNamingStrategy;
import org.hibernate.id.enhanced.StandardNamingStrategy;
import org.hibernate.query.sqm.mutation.internal.cte.CteInsertStrategy;
import org.hibernate.query.sqm.mutation.internal.cte.CteMutationStrategy;
import org.hibernate.query.sqm.mutation.internal.temptable.GlobalTemporaryTableInsertStrategy;
import org.hibernate.query.sqm.mutation.internal.temptable.GlobalTemporaryTableMutationStrategy;
import org.hibernate.query.sqm.mutation.internal.temptable.LocalTemporaryTableInsertStrategy;
import org.hibernate.query.sqm.mutation.internal.temptable.LocalTemporaryTableMutationStrategy;
import org.hibernate.query.sqm.mutation.internal.temptable.PersistentTableInsertStrategy;
import org.hibernate.query.sqm.mutation.internal.temptable.PersistentTableMutationStrategy;
import org.hibernate.query.sqm.mutation.spi.SqmMultiTableInsertStrategy;
import org.hibernate.query.sqm.mutation.spi.SqmMultiTableMutationStrategy;
import org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorBuilderImpl;
import org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorBuilderImpl;
@ -115,6 +120,7 @@ public class StrategySelectorBuilder {
);
strategySelector.registerStrategyLazily( JtaPlatform.class, new DefaultJtaPlatformSelector() );
addTransactionCoordinatorBuilders( strategySelector );
addSqmMultiTableInsertStrategies( strategySelector );
addSqmMultiTableMutationStrategies( strategySelector );
addImplicitNamingStrategies( strategySelector );
addColumnOrderingStrategies( strategySelector );
@ -177,6 +183,29 @@ public class StrategySelectorBuilder {
);
}
private static void addSqmMultiTableInsertStrategies(StrategySelectorImpl strategySelector) {
strategySelector.registerStrategyImplementor(
SqmMultiTableInsertStrategy.class,
CteInsertStrategy.SHORT_NAME,
CteInsertStrategy.class
);
strategySelector.registerStrategyImplementor(
SqmMultiTableInsertStrategy.class,
GlobalTemporaryTableInsertStrategy.SHORT_NAME,
GlobalTemporaryTableInsertStrategy.class
);
strategySelector.registerStrategyImplementor(
SqmMultiTableInsertStrategy.class,
LocalTemporaryTableInsertStrategy.SHORT_NAME,
LocalTemporaryTableInsertStrategy.class
);
strategySelector.registerStrategyImplementor(
SqmMultiTableInsertStrategy.class,
PersistentTableInsertStrategy.SHORT_NAME,
PersistentTableInsertStrategy.class
);
}
private static void addSqmMultiTableMutationStrategies(StrategySelectorImpl strategySelector) {
strategySelector.registerStrategyImplementor(
SqmMultiTableMutationStrategy.class,