Remove few NotYetImplementedFor6Exception

This commit is contained in:
Andrea Boriero 2021-10-05 13:43:14 +02:00 committed by Christian Beikov
parent aec5ce9d8a
commit 7a3ad20aea
16 changed files with 136 additions and 113 deletions

View File

@ -8,6 +8,8 @@ package org.hibernate.engine.query.spi;
import org.hibernate.Incubating; import org.hibernate.Incubating;
import org.hibernate.metamodel.model.domain.AllowableParameterType; import org.hibernate.metamodel.model.domain.AllowableParameterType;
import org.hibernate.metamodel.model.domain.EmbeddableDomainType;
import org.hibernate.metamodel.model.domain.internal.EntityTypeImpl;
import org.hibernate.query.QueryParameter; import org.hibernate.query.QueryParameter;
/** /**
@ -54,4 +56,12 @@ public abstract class AbstractParameterDescriptor implements QueryParameter {
public void resetExpectedType(AllowableParameterType expectedType) { public void resetExpectedType(AllowableParameterType expectedType) {
this.expectedType = expectedType; this.expectedType = expectedType;
} }
@Override
public boolean allowsMultiValuedBinding() {
if ( expectedType instanceof EntityTypeImpl ) {
return ( (EntityTypeImpl) expectedType ).getIdType() instanceof EmbeddableDomainType;
}
return expectedType instanceof EmbeddableDomainType;
}
} }

View File

@ -7,7 +7,6 @@
package org.hibernate.engine.query.spi; package org.hibernate.engine.query.spi;
import org.hibernate.Incubating; import org.hibernate.Incubating;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.metamodel.model.domain.AllowableParameterType; import org.hibernate.metamodel.model.domain.AllowableParameterType;
/** /**
@ -54,8 +53,4 @@ public class NamedParameterDescriptor extends AbstractParameterDescriptor {
return getName().hashCode(); return getName().hashCode();
} }
@Override
public boolean allowsMultiValuedBinding() {
throw new NotYetImplementedFor6Exception( getClass() );
}
} }

View File

@ -7,11 +7,8 @@
package org.hibernate.engine.query.spi; package org.hibernate.engine.query.spi;
import org.hibernate.Incubating; import org.hibernate.Incubating;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.query.sql.internal.NativeSelectQueryPlanImpl; import org.hibernate.query.sql.internal.NativeSelectQueryPlanImpl;
import org.hibernate.query.sql.spi.NativeNonSelectQueryDefinition;
import org.hibernate.query.sql.spi.NativeNonSelectQueryPlan;
import org.hibernate.query.sql.spi.NativeSelectQueryDefinition; import org.hibernate.query.sql.spi.NativeSelectQueryDefinition;
import org.hibernate.query.sql.spi.NativeSelectQueryPlan; import org.hibernate.query.sql.spi.NativeSelectQueryPlan;
import org.hibernate.query.sql.spi.ParameterRecognizer; import org.hibernate.query.sql.spi.ParameterRecognizer;
@ -50,12 +47,4 @@ public interface NativeQueryInterpreter extends Service {
); );
} }
/**
* Creates a new query plan for the passed native query values
*/
default NativeNonSelectQueryPlan createQueryPlan(
NativeNonSelectQueryDefinition queryDefinition,
SessionFactoryImplementor sessionFactory) {
throw new NotYetImplementedFor6Exception( );
}
} }

View File

@ -7,7 +7,6 @@
package org.hibernate.engine.query.spi; package org.hibernate.engine.query.spi;
import org.hibernate.Incubating; import org.hibernate.Incubating;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.metamodel.model.domain.AllowableParameterType; import org.hibernate.metamodel.model.domain.AllowableParameterType;
/** /**
@ -42,8 +41,5 @@ public class OrdinalParameterDescriptor extends AbstractParameterDescriptor {
return valuePosition; return valuePosition;
} }
@Override
public boolean allowsMultiValuedBinding() {
throw new NotYetImplementedFor6Exception( getClass() );
}
} }

View File

@ -6,21 +6,9 @@
*/ */
package org.hibernate.loader.ast.spi; package org.hibernate.loader.ast.spi;
import java.util.function.Consumer;
import java.util.function.Supplier;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.engine.spi.LoadQueryInfluencers; import org.hibernate.engine.spi.LoadQueryInfluencers;
import org.hibernate.metamodel.mapping.ModelPart; import org.hibernate.metamodel.mapping.ModelPart;
import org.hibernate.query.NavigablePath;
import org.hibernate.sql.ast.spi.FromClauseAccess;
import org.hibernate.sql.ast.spi.SqlAliasBase;
import org.hibernate.sql.ast.spi.SqlAstCreationState;
import org.hibernate.sql.ast.spi.SqlAstCreationContext;
import org.hibernate.sql.ast.spi.SqlExpressionResolver;
import org.hibernate.sql.ast.tree.from.RootTableGroupProducer; import org.hibernate.sql.ast.tree.from.RootTableGroupProducer;
import org.hibernate.sql.ast.tree.from.TableGroup;
import org.hibernate.sql.ast.tree.predicate.Predicate;
/** /**
* Contract for things that can be loaded by a Loader. * Contract for things that can be loaded by a Loader.
@ -38,27 +26,4 @@ public interface Loadable extends ModelPart, RootTableGroupProducer {
String getRootPathName(); String getRootPathName();
@Override
default TableGroup createRootTableGroup(
boolean canUseInnerJoins,
NavigablePath navigablePath,
String explicitSourceAlias,
Supplier<Consumer<Predicate>> additionalPredicateCollectorAccess,
SqlAstCreationState creationState,
SqlAstCreationContext creationContext) {
throw new NotYetImplementedFor6Exception( getClass() );
}
@Override
default TableGroup createRootTableGroup(
boolean canUseInnerJoins,
NavigablePath navigablePath,
String explicitSourceAlias,
Supplier<Consumer<Predicate>> additionalPredicateCollectorAccess,
SqlAliasBase sqlAliasBase,
SqlExpressionResolver expressionResolver,
FromClauseAccess fromClauseAccess,
SqlAstCreationContext creationContext) {
throw new NotYetImplementedFor6Exception( getClass() );
}
} }

View File

@ -12,7 +12,6 @@ import java.util.List;
import org.hibernate.Incubating; import org.hibernate.Incubating;
import org.hibernate.NotYetImplementedFor6Exception; import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.internal.util.MutableInteger;
import org.hibernate.mapping.IndexedConsumer; import org.hibernate.mapping.IndexedConsumer;
import org.hibernate.sql.ast.Clause; import org.hibernate.sql.ast.Clause;
@ -71,13 +70,6 @@ public interface Bindable extends JdbcMappingContainer {
return forEachJdbcType( 0, action ); return forEachJdbcType( 0, action );
} }
/**
* Visit each JdbcMapping starting from the given offset
*/
default int forEachJdbcType(int offset, IndexedConsumer<JdbcMapping> action) {
throw new NotYetImplementedFor6Exception( getClass() );
}
/** /**
* @asciidoc * @asciidoc
* *

View File

@ -6,7 +6,6 @@
*/ */
package org.hibernate.metamodel.mapping; package org.hibernate.metamodel.mapping;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.query.NavigablePath; import org.hibernate.query.NavigablePath;
import org.hibernate.sql.ast.tree.from.TableGroup; import org.hibernate.sql.ast.tree.from.TableGroup;
import org.hibernate.sql.ast.tree.from.TableGroupJoinProducer; import org.hibernate.sql.ast.tree.from.TableGroupJoinProducer;
@ -40,11 +39,9 @@ public interface EntityAssociationMapping extends ModelPart, Association, TableG
/** /**
* Create a delayed DomainResult for a specific reference to this ModelPart. * Create a delayed DomainResult for a specific reference to this ModelPart.
*/ */
default <T> DomainResult<T> createDelayedDomainResult( <T> DomainResult<T> createDelayedDomainResult(
NavigablePath navigablePath, NavigablePath navigablePath,
TableGroup tableGroup, TableGroup tableGroup,
String resultVariable, String resultVariable,
DomainResultCreationState creationState) { DomainResultCreationState creationState);
throw new NotYetImplementedFor6Exception( getClass() );
}
} }

View File

@ -15,7 +15,6 @@ import java.util.function.Consumer;
import java.util.function.Supplier; import java.util.function.Supplier;
import org.hibernate.Filter; import org.hibernate.Filter;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.engine.spi.LoadQueryInfluencers; import org.hibernate.engine.spi.LoadQueryInfluencers;
import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.loader.ast.spi.Loadable; import org.hibernate.loader.ast.spi.Loadable;
@ -110,40 +109,30 @@ public interface EntityMappingType extends ManagedMappingType, EntityValuedModel
} }
@Override @Override
default ModelPart findSubPart(String name, EntityMappingType targetType) { ModelPart findSubPart(String name, EntityMappingType targetType);
throw new NotYetImplementedFor6Exception( getClass() );
}
@Override @Override
default void visitSubParts(Consumer<ModelPart> consumer, EntityMappingType targetType) { void visitSubParts(Consumer<ModelPart> consumer, EntityMappingType targetType);
throw new NotYetImplementedFor6Exception( getClass() );
}
@Override @Override
default <T> DomainResult<T> createDomainResult( <T> DomainResult<T> createDomainResult(
NavigablePath navigablePath, NavigablePath navigablePath,
TableGroup tableGroup, TableGroup tableGroup,
String resultVariable, String resultVariable,
DomainResultCreationState creationState) { DomainResultCreationState creationState);
throw new NotYetImplementedFor6Exception( getClass() );
}
@Override @Override
default void applySqlSelections( void applySqlSelections(
NavigablePath navigablePath, NavigablePath navigablePath,
TableGroup tableGroup, TableGroup tableGroup,
DomainResultCreationState creationState) { DomainResultCreationState creationState);
throw new NotYetImplementedFor6Exception( getClass() );
}
@Override @Override
default void applySqlSelections( void applySqlSelections(
NavigablePath navigablePath, NavigablePath navigablePath,
TableGroup tableGroup, TableGroup tableGroup,
DomainResultCreationState creationState, DomainResultCreationState creationState,
BiConsumer<SqlSelection,JdbcMapping> selectionConsumer) { BiConsumer<SqlSelection,JdbcMapping> selectionConsumer);
throw new NotYetImplementedFor6Exception( getClass() );
}
@Override @Override
default int getJdbcTypeCount() { default int getJdbcTypeCount() {
@ -151,24 +140,18 @@ public interface EntityMappingType extends ManagedMappingType, EntityValuedModel
} }
@Override @Override
default int forEachJdbcType(int offset, IndexedConsumer<JdbcMapping> action) { int forEachJdbcType(int offset, IndexedConsumer<JdbcMapping> action);
throw new NotYetImplementedFor6Exception( getClass() );
}
@Override @Override
default Object disassemble(Object value, SharedSessionContractImplementor session) { Object disassemble(Object value, SharedSessionContractImplementor session);
throw new NotYetImplementedFor6Exception( getClass() );
}
@Override @Override
default int forEachDisassembledJdbcValue( int forEachDisassembledJdbcValue(
Object value, Object value,
Clause clause, Clause clause,
int offset, int offset,
JdbcValuesConsumer valuesConsumer, JdbcValuesConsumer valuesConsumer,
SharedSessionContractImplementor session) { SharedSessionContractImplementor session);
throw new NotYetImplementedFor6Exception( getClass() );
}
@Override @Override
default int forEachJdbcValue( default int forEachJdbcValue(
@ -187,11 +170,7 @@ public interface EntityMappingType extends ManagedMappingType, EntityValuedModel
return getEntityPersister().getEntityMetamodel().hasSubclasses(); return getEntityPersister().getEntityMetamodel().hasSubclasses();
} }
default AttributeMapping findDeclaredAttributeMapping(String name) { AttributeMapping findDeclaredAttributeMapping(String name);
throw new NotYetImplementedFor6Exception( getClass() );
// or ?
//throw new UnsupportedOperationException();
}
/** /**
* Get the number of attributes defined on this class - do not access attributes defined on the super * Get the number of attributes defined on this class - do not access attributes defined on the super
@ -203,16 +182,12 @@ public interface EntityMappingType extends ManagedMappingType, EntityValuedModel
/** /**
* Get access to the attributes defined on this class - do not access attributes defined on the super * Get access to the attributes defined on this class - do not access attributes defined on the super
*/ */
default Collection<AttributeMapping> getDeclaredAttributeMappings() { Collection<AttributeMapping> getDeclaredAttributeMappings();
throw new NotYetImplementedFor6Exception( getClass() );
}
/** /**
* Visit attributes defined on this class - do not visit attributes defined on the super * Visit attributes defined on this class - do not visit attributes defined on the super
*/ */
default void visitDeclaredAttributeMappings(Consumer<? super AttributeMapping> action) { void visitDeclaredAttributeMappings(Consumer<? super AttributeMapping> action);
throw new NotYetImplementedFor6Exception( getClass() );
}
default EntityMappingType getSuperMappingType() { default EntityMappingType getSuperMappingType() {
return null; return null;
@ -244,7 +219,9 @@ public interface EntityMappingType extends ManagedMappingType, EntityValuedModel
EntityIdentifierMapping getIdentifierMapping(); EntityIdentifierMapping getIdentifierMapping();
EntityDiscriminatorMapping getDiscriminatorMapping(); EntityDiscriminatorMapping getDiscriminatorMapping();
Object getDiscriminatorValue(); Object getDiscriminatorValue();
String getSubclassForDiscriminatorValue(Object value); String getSubclassForDiscriminatorValue(Object value);
EntityVersionMapping getVersionMapping(); EntityVersionMapping getVersionMapping();
@ -278,9 +255,7 @@ public interface EntityMappingType extends ManagedMappingType, EntityValuedModel
// by default do nothing // by default do nothing
} }
default void visitConstraintOrderedTables(ConstraintOrderedTableConsumer consumer) { void visitConstraintOrderedTables(ConstraintOrderedTableConsumer consumer);
throw new NotYetImplementedFor6Exception( getClass() );
}
default EntityMappingType getRootEntityDescriptor() { default EntityMappingType getRootEntityDescriptor() {
final EntityMappingType superMappingType = getSuperMappingType(); final EntityMappingType superMappingType = getSuperMappingType();

View File

@ -367,6 +367,15 @@ public class EntityCollectionPart
: fkTargetModelPart; : fkTargetModelPart;
} }
@Override
public <T> DomainResult<T> createDelayedDomainResult(
NavigablePath navigablePath,
TableGroup tableGroup,
String resultVariable,
DomainResultCreationState creationState) {
throw new NotYetImplementedFor6Exception( getClass() );
}
@Override @Override
public JavaType<?> getJavaTypeDescriptor() { public JavaType<?> getJavaTypeDescriptor() {
return getEntityMappingType().getJavaTypeDescriptor(); return getEntityMappingType().getJavaTypeDescriptor();

View File

@ -781,6 +781,18 @@ public class PluralAttributeMappingImpl
} }
} }
@Override
public TableGroup createRootTableGroup(
boolean canUseInnerJoins,
NavigablePath navigablePath,
String explicitSourceAlias,
Supplier<Consumer<Predicate>> additionalPredicateCollectorAccess,
SqlAliasBase sqlAliasBase,
SqlAstCreationState creationState,
SqlAstCreationContext creationContext) {
throw new NotYetImplementedFor6Exception( getClass() );
}
@Override @Override
public boolean isAffectedByEnabledFilters(LoadQueryInfluencers influencers) { public boolean isAffectedByEnabledFilters(LoadQueryInfluencers influencers) {
return getCollectionDescriptor().isAffectedByEnabledFilters( influencers ); return getCollectionDescriptor().isAffectedByEnabledFilters( influencers );

View File

@ -6,6 +6,8 @@
*/ */
package org.hibernate.metamodel.model.domain; package org.hibernate.metamodel.model.domain;
import org.hibernate.metamodel.ManagedTypeRepresentationStrategy;
import jakarta.persistence.metamodel.EmbeddableType; import jakarta.persistence.metamodel.EmbeddableType;
/** /**
@ -17,4 +19,5 @@ import jakarta.persistence.metamodel.EmbeddableType;
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public interface EmbeddableDomainType<J> extends ManagedDomainType<J>, EmbeddableType<J>, AllowableParameterType<J> { public interface EmbeddableDomainType<J> extends ManagedDomainType<J>, EmbeddableType<J>, AllowableParameterType<J> {
ManagedTypeRepresentationStrategy getRepresentationStrategy();
} }

View File

@ -9,12 +9,15 @@ package org.hibernate.metamodel.model.domain.internal;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.metamodel.UnsupportedMappingException; import org.hibernate.metamodel.UnsupportedMappingException;
import org.hibernate.metamodel.mapping.MappingModelExpressable; import org.hibernate.metamodel.mapping.MappingModelExpressable;
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType; import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
import org.hibernate.metamodel.model.domain.AllowableParameterType; import org.hibernate.metamodel.model.domain.AllowableParameterType;
import org.hibernate.metamodel.model.domain.TupleType; import org.hibernate.metamodel.model.domain.TupleType;
import org.hibernate.query.sqm.SqmExpressable; import org.hibernate.query.sqm.SqmExpressable;
import org.hibernate.sql.ast.Clause;
import org.hibernate.type.descriptor.java.JavaType; import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.java.ObjectArrayJavaTypeDescriptor; import org.hibernate.type.descriptor.java.ObjectArrayJavaTypeDescriptor;
@ -84,4 +87,20 @@ public class ArrayTupleType implements TupleType<Object[]>, AllowableParameterTy
public String toString() { public String toString() {
return "ArrayTupleType" + Arrays.toString( components ); return "ArrayTupleType" + Arrays.toString( components );
} }
@Override
public Object disassemble(Object value, SharedSessionContractImplementor session) {
throw new NotYetImplementedFor6Exception( getClass() );
}
@Override
public int forEachDisassembledJdbcValue(
Object value,
Clause clause,
int offset,
JdbcValuesConsumer valuesConsumer,
SharedSessionContractImplementor session) {
throw new NotYetImplementedFor6Exception(getClass());
}
} }

View File

@ -74,7 +74,7 @@ public class EntityTypeImpl<J>
.resolve( StandardBasicTypes.STRING ); .resolve( StandardBasicTypes.STRING );
} }
this.discriminatorPathSource = new DiscriminatorSqmPathSource<>( this.discriminatorPathSource = new DiscriminatorSqmPathSource(
discriminatorType, discriminatorType,
this, this,
entityPersister entityPersister

View File

@ -137,6 +137,21 @@ public class GoofyPersisterClassProvider implements PersisterClassResolver {
return null; return null;
} }
@Override
public AttributeMapping findDeclaredAttributeMapping(String name) {
return null;
}
@Override
public java.util.Collection<AttributeMapping> getDeclaredAttributeMappings() {
return null;
}
@Override
public void visitDeclaredAttributeMappings(Consumer<? super AttributeMapping> action) {
}
@Override @Override
public EntityMetamodel getEntityMetamodel() { public EntityMetamodel getEntityMetamodel() {
return null; return null;
@ -627,6 +642,11 @@ public class GoofyPersisterClassProvider implements PersisterClassResolver {
return null; return null;
} }
@Override
public void visitConstraintOrderedTables(ConstraintOrderedTableConsumer consumer) {
}
@Override @Override
public EntityDiscriminatorMapping getDiscriminatorMapping() { public EntityDiscriminatorMapping getDiscriminatorMapping() {
return null; return null;

View File

@ -162,6 +162,21 @@ public class PersisterClassProviderTest {
return null; return null;
} }
@Override
public AttributeMapping findDeclaredAttributeMapping(String name) {
return null;
}
@Override
public java.util.Collection<AttributeMapping> getDeclaredAttributeMappings() {
return null;
}
@Override
public void visitDeclaredAttributeMappings(Consumer<? super AttributeMapping> action) {
}
@Override @Override
public EntityMetamodel getEntityMetamodel() { public EntityMetamodel getEntityMetamodel() {
return null; return null;
@ -679,6 +694,11 @@ public class PersisterClassProviderTest {
return null; return null;
} }
@Override
public void visitConstraintOrderedTables(ConstraintOrderedTableConsumer consumer) {
}
@Override @Override
public EntityDiscriminatorMapping getDiscriminatorMapping() { public EntityDiscriminatorMapping getDiscriminatorMapping() {
return null; return null;

View File

@ -7,6 +7,7 @@
package org.hibernate.orm.test.legacy; package org.hibernate.orm.test.legacy;
import java.io.Serializable; import java.io.Serializable;
import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.Hashtable; import java.util.Hashtable;
@ -119,6 +120,21 @@ public class CustomPersister implements EntityPersister {
return Custom.class.getName(); return Custom.class.getName();
} }
@Override
public AttributeMapping findDeclaredAttributeMapping(String name) {
return null;
}
@Override
public Collection<AttributeMapping> getDeclaredAttributeMappings() {
return null;
}
@Override
public void visitDeclaredAttributeMappings(Consumer<? super AttributeMapping> action) {
}
public boolean isSubclassEntityName(String entityName) { public boolean isSubclassEntityName(String entityName) {
return Custom.class.getName().equals(entityName); return Custom.class.getName().equals(entityName);
} }
@ -739,6 +755,11 @@ public class CustomPersister implements EntityPersister {
return null; return null;
} }
@Override
public void visitConstraintOrderedTables(ConstraintOrderedTableConsumer consumer) {
}
@Override @Override
public EntityDiscriminatorMapping getDiscriminatorMapping() { public EntityDiscriminatorMapping getDiscriminatorMapping() {
return null; return null;