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.metamodel.model.domain.AllowableParameterType;
import org.hibernate.metamodel.model.domain.EmbeddableDomainType;
import org.hibernate.metamodel.model.domain.internal.EntityTypeImpl;
import org.hibernate.query.QueryParameter;
/**
@ -54,4 +56,12 @@ public abstract class AbstractParameterDescriptor implements QueryParameter {
public void resetExpectedType(AllowableParameterType 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;
import org.hibernate.Incubating;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.metamodel.model.domain.AllowableParameterType;
/**
@ -54,8 +53,4 @@ public class NamedParameterDescriptor extends AbstractParameterDescriptor {
return getName().hashCode();
}
@Override
public boolean allowsMultiValuedBinding() {
throw new NotYetImplementedFor6Exception( getClass() );
}
}

View File

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

View File

@ -6,21 +6,9 @@
*/
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.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.TableGroup;
import org.hibernate.sql.ast.tree.predicate.Predicate;
/**
* Contract for things that can be loaded by a Loader.
@ -38,27 +26,4 @@ public interface Loadable extends ModelPart, RootTableGroupProducer {
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.NotYetImplementedFor6Exception;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.internal.util.MutableInteger;
import org.hibernate.mapping.IndexedConsumer;
import org.hibernate.sql.ast.Clause;
@ -71,13 +70,6 @@ public interface Bindable extends JdbcMappingContainer {
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
*

View File

@ -6,7 +6,6 @@
*/
package org.hibernate.metamodel.mapping;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.query.NavigablePath;
import org.hibernate.sql.ast.tree.from.TableGroup;
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.
*/
default <T> DomainResult<T> createDelayedDomainResult(
<T> DomainResult<T> createDelayedDomainResult(
NavigablePath navigablePath,
TableGroup tableGroup,
String resultVariable,
DomainResultCreationState creationState) {
throw new NotYetImplementedFor6Exception( getClass() );
}
DomainResultCreationState creationState);
}

View File

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

View File

@ -367,6 +367,15 @@ public class EntityCollectionPart
: fkTargetModelPart;
}
@Override
public <T> DomainResult<T> createDelayedDomainResult(
NavigablePath navigablePath,
TableGroup tableGroup,
String resultVariable,
DomainResultCreationState creationState) {
throw new NotYetImplementedFor6Exception( getClass() );
}
@Override
public JavaType<?> 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
public boolean isAffectedByEnabledFilters(LoadQueryInfluencers influencers) {
return getCollectionDescriptor().isAffectedByEnabledFilters( influencers );

View File

@ -6,6 +6,8 @@
*/
package org.hibernate.metamodel.model.domain;
import org.hibernate.metamodel.ManagedTypeRepresentationStrategy;
import jakarta.persistence.metamodel.EmbeddableType;
/**
@ -17,4 +19,5 @@ import jakarta.persistence.metamodel.EmbeddableType;
* @author Steve Ebersole
*/
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.List;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.metamodel.UnsupportedMappingException;
import org.hibernate.metamodel.mapping.MappingModelExpressable;
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
import org.hibernate.metamodel.model.domain.AllowableParameterType;
import org.hibernate.metamodel.model.domain.TupleType;
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.ObjectArrayJavaTypeDescriptor;
@ -84,4 +87,20 @@ public class ArrayTupleType implements TupleType<Object[]>, AllowableParameterTy
public String toString() {
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 );
}
this.discriminatorPathSource = new DiscriminatorSqmPathSource<>(
this.discriminatorPathSource = new DiscriminatorSqmPathSource(
discriminatorType,
this,
entityPersister

View File

@ -137,6 +137,21 @@ public class GoofyPersisterClassProvider implements PersisterClassResolver {
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
public EntityMetamodel getEntityMetamodel() {
return null;
@ -627,6 +642,11 @@ public class GoofyPersisterClassProvider implements PersisterClassResolver {
return null;
}
@Override
public void visitConstraintOrderedTables(ConstraintOrderedTableConsumer consumer) {
}
@Override
public EntityDiscriminatorMapping getDiscriminatorMapping() {
return null;

View File

@ -162,6 +162,21 @@ public class PersisterClassProviderTest {
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
public EntityMetamodel getEntityMetamodel() {
return null;
@ -679,6 +694,11 @@ public class PersisterClassProviderTest {
return null;
}
@Override
public void visitConstraintOrderedTables(ConstraintOrderedTableConsumer consumer) {
}
@Override
public EntityDiscriminatorMapping getDiscriminatorMapping() {
return null;

View File

@ -7,6 +7,7 @@
package org.hibernate.orm.test.legacy;
import java.io.Serializable;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Hashtable;
@ -119,6 +120,21 @@ public class CustomPersister implements EntityPersister {
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) {
return Custom.class.getName().equals(entityName);
}
@ -739,6 +755,11 @@ public class CustomPersister implements EntityPersister {
return null;
}
@Override
public void visitConstraintOrderedTables(ConstraintOrderedTableConsumer consumer) {
}
@Override
public EntityDiscriminatorMapping getDiscriminatorMapping() {
return null;