Get rid of some NotYetImplementedFor6Exception uses

This commit is contained in:
Christian Beikov 2022-03-28 11:30:09 +02:00
parent 13460034fd
commit 063a13c8a3
10 changed files with 61 additions and 67 deletions

View File

@ -17,7 +17,6 @@ import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.boot.model.TypeContributions;
import org.hibernate.community.dialect.identity.FirebirdIdentityColumnSupport;
import org.hibernate.community.dialect.pagination.SkipFirstLimitHandler;
@ -803,7 +802,7 @@ public class FirebirdDialect extends Dialect {
@Override
public void appendDatetimeFormat(SqlAppender appender, String format) {
throw new NotYetImplementedFor6Exception( "format() function not supported on Firebird" );
throw new UnsupportedOperationException( "format() function not supported on Firebird" );
}
@Override

View File

@ -9,7 +9,6 @@ package org.hibernate.community.dialect;
import java.sql.DatabaseMetaData;
import java.sql.Types;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.community.dialect.sequence.MaxDBSequenceSupport;
import org.hibernate.community.dialect.sequence.SequenceInformationExtractorSAPDBDatabaseImpl;
import org.hibernate.dialect.AbstractTransactSQLDialect;
@ -18,12 +17,19 @@ import org.hibernate.dialect.function.CommonFunctionFactory;
import org.hibernate.dialect.pagination.LimitHandler;
import org.hibernate.dialect.pagination.LimitOffsetLimitHandler;
import org.hibernate.dialect.sequence.SequenceSupport;
import org.hibernate.dialect.temptable.TemporaryTable;
import org.hibernate.dialect.temptable.TemporaryTableKind;
import org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.metamodel.mapping.EntityMappingType;
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
import org.hibernate.query.sqm.TrimSpec;
import org.hibernate.query.spi.QueryEngine;
import org.hibernate.query.sqm.mutation.internal.temptable.AfterUseAction;
import org.hibernate.query.sqm.mutation.internal.temptable.BeforeUseAction;
import org.hibernate.query.sqm.mutation.internal.temptable.LocalTemporaryTableInsertStrategy;
import org.hibernate.query.sqm.mutation.internal.temptable.LocalTemporaryTableMutationStrategy;
import org.hibernate.query.sqm.mutation.spi.SqmMultiTableInsertStrategy;
import org.hibernate.query.sqm.mutation.spi.SqmMultiTableMutationStrategy;
import org.hibernate.sql.ast.SqlAstTranslator;
import org.hibernate.sql.ast.SqlAstTranslatorFactory;
@ -273,23 +279,50 @@ public class MaxDBDialect extends Dialect {
public SqmMultiTableMutationStrategy getFallbackSqmMutationStrategy(
EntityMappingType rootEntityDescriptor,
RuntimeModelCreationContext runtimeModelCreationContext) {
throw new NotYetImplementedFor6Exception( getClass() );
return new LocalTemporaryTableMutationStrategy(
TemporaryTable.createIdTable(
rootEntityDescriptor,
basename -> "temp." + TemporaryTable.ID_TABLE_PREFIX + basename,
this,
runtimeModelCreationContext
),
runtimeModelCreationContext.getSessionFactory()
);
}
// return new LocalTemporaryTableBulkIdStrategy(
// new IdTableSupportStandardImpl() {
// @Override
// public String generateIdTableName(String baseName) {
// return "temp." + super.generateIdTableName( baseName );
// }
//
// @Override
// public String getCreateIdTableStatementOptions() {
// return "ignore rollback";
// }
// },
// AfterUseAction.DROP,
// null
// );
@Override
public SqmMultiTableInsertStrategy getFallbackSqmInsertStrategy(
EntityMappingType rootEntityDescriptor,
RuntimeModelCreationContext runtimeModelCreationContext) {
return new LocalTemporaryTableInsertStrategy(
TemporaryTable.createEntityTable(
rootEntityDescriptor,
name -> "temp." + TemporaryTable.ENTITY_TABLE_PREFIX + name,
this,
runtimeModelCreationContext
),
runtimeModelCreationContext.getSessionFactory()
);
}
@Override
public BeforeUseAction getTemporaryTableBeforeUseAction() {
return BeforeUseAction.CREATE;
}
@Override
public AfterUseAction getTemporaryTableAfterUseAction() {
return AfterUseAction.DROP;
}
@Override
public TemporaryTableKind getSupportedTemporaryTableKind() {
return TemporaryTableKind.LOCAL;
}
@Override
public String getTemporaryTableCreateOptions() {
return "ignore rollback";
}
@Override

View File

@ -6,7 +6,6 @@
*/
package org.hibernate.community.dialect;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.boot.model.TypeContributions;
import org.hibernate.community.dialect.identity.MimerSQLIdentityColumnSupport;
import org.hibernate.community.dialect.sequence.MimerSequenceSupport;
@ -318,7 +317,7 @@ public class MimerSQLDialect extends Dialect {
@Override
public void appendDatetimeFormat(SqlAppender appender, String format) {
throw new NotYetImplementedFor6Exception("format() function not supported on Mimer SQL");
throw new UnsupportedOperationException("format() function not supported on Mimer SQL");
}
@Override

View File

@ -6,7 +6,6 @@
*/
package org.hibernate.dialect;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.boot.model.TypeContributions;
import org.hibernate.dialect.function.CastingConcatFunction;
import org.hibernate.dialect.function.CommonFunctionFactory;
@ -362,7 +361,7 @@ public class DerbyDialect extends Dialect {
case WEEK:
case DAY_OF_YEAR:
case DAY_OF_WEEK:
throw new NotYetImplementedFor6Exception("field type not supported on Derby: " + unit);
throw new UnsupportedOperationException("field type not supported on Derby: " + unit);
case DAY_OF_MONTH:
return "day";
default:
@ -632,7 +631,7 @@ public class DerbyDialect extends Dialect {
@Override
public void appendDatetimeFormat(SqlAppender appender, String format) {
throw new NotYetImplementedFor6Exception("format() function not supported on Derby");
throw new UnsupportedOperationException("format() function not supported on Derby");
}
@Override

View File

@ -6,7 +6,6 @@
*/
package org.hibernate.dialect;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.boot.model.TypeContributions;
import org.hibernate.dialect.function.CommonFunctionFactory;
import org.hibernate.dialect.function.CountFunction;
@ -305,7 +304,7 @@ public class SybaseDialect extends AbstractTransactSQLDialect {
@Override
public void appendDatetimeFormat(SqlAppender appender, String format) {
throw new NotYetImplementedFor6Exception( "format() function not supported on Sybase");
throw new UnsupportedOperationException( "format() function not supported on Sybase");
}
@Override

View File

@ -6,7 +6,6 @@
*/
package org.hibernate.query.hql.internal;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.query.hql.HqlLogging;
import org.hibernate.query.hql.spi.SemanticPathPart;
import org.hibernate.query.hql.spi.SqmCreationState;
@ -54,6 +53,6 @@ public class DomainPathPart implements SemanticPathPart {
SqmExpression<?> selector,
boolean isTerminal,
SqmCreationState creationState) {
throw new NotYetImplementedFor6Exception( getClass() );
return currentPath.resolveIndexedAccess( selector, isTerminal, creationState );
}
}

View File

@ -9,7 +9,6 @@ package org.hibernate.query.sqm.internal;
import java.util.List;
import java.util.Locale;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.query.QueryLogging;
import org.hibernate.query.sqm.SemanticQueryWalker;
import org.hibernate.query.sqm.sql.internal.SelfInterpretingSqmPath;
@ -1037,12 +1036,12 @@ public class SqmTreePrinter implements SemanticQueryWalker<Object> {
@Override
public Object visitEnumLiteral(SqmEnumLiteral<?> sqmEnumLiteral) {
throw new NotYetImplementedFor6Exception( getClass() );
return null;
}
@Override
public Object visitFieldLiteral(SqmFieldLiteral<?> sqmFieldLiteral) {
throw new NotYetImplementedFor6Exception( getClass() );
return null;
}
@Override

View File

@ -8,7 +8,6 @@ package org.hibernate.query.sqm.tree.expression;
import java.util.Objects;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.procedure.spi.NamedCallableQueryMemento;
import org.hibernate.query.BindableType;
import org.hibernate.query.ParameterMetadata;
@ -17,10 +16,7 @@ import org.hibernate.query.spi.QueryParameterImplementor;
import org.hibernate.query.sqm.NodeBuilder;
import org.hibernate.query.sqm.SemanticQueryWalker;
import org.hibernate.query.sqm.SqmExpressible;
import org.hibernate.query.sqm.sql.internal.DomainResultProducer;
import org.hibernate.query.sqm.tree.SqmCopyContext;
import org.hibernate.sql.results.graph.DomainResult;
import org.hibernate.sql.results.graph.DomainResultCreationState;
/**
* {@link JpaParameterExpression} created via JPA {@link jakarta.persistence.criteria.CriteriaBuilder}.
@ -34,7 +30,7 @@ import org.hibernate.sql.results.graph.DomainResultCreationState;
*/
public class JpaCriteriaParameter<T>
extends AbstractSqmExpression<T>
implements SqmParameter<T>, QueryParameterImplementor<T>, DomainResultProducer<T> {
implements SqmParameter<T>, QueryParameterImplementor<T> {
private final String name;
private boolean allowsMultiValuedBinding;
@ -151,18 +147,6 @@ public class JpaCriteriaParameter<T>
sb.append( getName() );
}
@Override
public DomainResult<T> createDomainResult(
String resultVariable,
DomainResultCreationState creationState) {
throw new NotYetImplementedFor6Exception( getClass() );
}
@Override
public void applySqlSelections(DomainResultCreationState creationState) {
throw new NotYetImplementedFor6Exception( getClass() );
}
@Override
public boolean equals(Object o) {
if ( this == o ) {

View File

@ -9,17 +9,13 @@ package org.hibernate.query.sqm.tree.expression;
import java.util.ArrayList;
import java.util.List;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.query.criteria.JpaExpression;
import org.hibernate.query.criteria.JpaSimpleCase;
import org.hibernate.query.internal.QueryHelper;
import org.hibernate.query.sqm.NodeBuilder;
import org.hibernate.query.sqm.SqmExpressible;
import org.hibernate.query.sqm.SemanticQueryWalker;
import org.hibernate.query.sqm.sql.internal.DomainResultProducer;
import org.hibernate.query.sqm.tree.SqmCopyContext;
import org.hibernate.sql.results.graph.DomainResult;
import org.hibernate.sql.results.graph.DomainResultCreationState;
import jakarta.persistence.criteria.Expression;
@ -28,7 +24,7 @@ import jakarta.persistence.criteria.Expression;
*/
public class SqmCaseSimple<T, R>
extends AbstractSqmExpression<R>
implements JpaSimpleCase<T, R>, DomainResultProducer<R> {
implements JpaSimpleCase<T, R> {
private final SqmExpression<T> fixture;
private final List<WhenFragment<T, R>> whenFragments;
private SqmExpression<R> otherwise;
@ -141,18 +137,6 @@ public class SqmCaseSimple<T, R>
return "<simple-case>";
}
@Override
public DomainResult<R> createDomainResult(
String resultVariable,
DomainResultCreationState creationState) {
throw new NotYetImplementedFor6Exception( getClass() );
}
@Override
public void applySqlSelections(DomainResultCreationState creationState) {
throw new NotYetImplementedFor6Exception( getClass() );
}
public static class WhenFragment<T,R> {
private final SqmExpression<T> checkValue;
private final SqmExpression<R> result;

View File

@ -11,7 +11,6 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.query.sqm.DynamicInstantiationNature;
import org.hibernate.query.sqm.sql.ConversionException;
import org.hibernate.query.sqm.sql.internal.DomainResultProducer;
@ -111,7 +110,7 @@ public class DynamicInstantiation<T> implements DomainResultProducer {
@Override
public void applySqlSelections(DomainResultCreationState creationState) {
throw new NotYetImplementedFor6Exception( getClass() );
throw new UnsupportedOperationException( "dynamic instantiation in a sub-query is unsupported" );
}
//