Remove Bindable NotYetImplementedFor6Exception

This commit is contained in:
Andrea Boriero 2021-10-06 12:27:45 +02:00 committed by Christian Beikov
parent c612669bb5
commit ee11f9a9ef
11 changed files with 151 additions and 20 deletions

View File

@ -10,7 +10,6 @@ import java.util.ArrayList;
import java.util.List;
import org.hibernate.Incubating;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.mapping.IndexedConsumer;
import org.hibernate.sql.ast.Clause;
@ -115,9 +114,7 @@ public interface Bindable extends JdbcMappingContainer {
* Note that the identifier is not part of this disassembled state. Note also
* how the embedded value results in a sub-array.
*/
default Object disassemble(Object value, SharedSessionContractImplementor session) {
throw new NotYetImplementedFor6Exception( getClass() );
}
Object disassemble(Object value, SharedSessionContractImplementor session);
/**
* @asciidoc
@ -143,14 +140,12 @@ public interface Bindable extends JdbcMappingContainer {
return forEachDisassembledJdbcValue( value, clause, 0, valuesConsumer, session );
}
default int forEachDisassembledJdbcValue(
int forEachDisassembledJdbcValue(
Object value,
Clause clause,
int offset,
JdbcValuesConsumer valuesConsumer,
SharedSessionContractImplementor session) {
throw new NotYetImplementedFor6Exception( getClass() );
}
SharedSessionContractImplementor session);
/**
* Visit each constituent JDBC value extracted from the entity instance itself.

View File

@ -24,6 +24,7 @@ import org.hibernate.metamodel.mapping.SelectableConsumer;
import org.hibernate.metamodel.mapping.SelectableMapping;
import org.hibernate.metamodel.model.domain.NavigableRole;
import org.hibernate.query.NavigablePath;
import org.hibernate.sql.ast.Clause;
import org.hibernate.sql.ast.spi.FromClauseAccess;
import org.hibernate.sql.ast.spi.SqlAstCreationState;
import org.hibernate.sql.ast.spi.SqlExpressionResolver;
@ -143,6 +144,16 @@ public class AnyDiscriminatorPart implements BasicValuedModelPart, FetchOptions,
return discriminator;
}
@Override
public int forEachDisassembledJdbcValue(
Object value,
Clause clause,
int offset,
JdbcValuesConsumer valuesConsumer,
SharedSessionContractImplementor session) {
throw new NotYetImplementedFor6Exception( getClass() );
}
@Override
public void breakDownJdbcValues(Object domainValue, JdbcValueConsumer valueConsumer, SharedSessionContractImplementor session) {
valueConsumer.consume( domainValue, this );

View File

@ -227,6 +227,21 @@ public class AnyKeyPart implements BasicValuedModelPart, FetchOptions {
return Collections.singletonList( jdbcMapping );
}
@Override
public Object disassemble(Object value, SharedSessionContractImplementor session) {
return anyPart.disassemble( value, session );
}
@Override
public int forEachDisassembledJdbcValue(
Object value,
Clause clause,
int offset,
JdbcValuesConsumer valuesConsumer,
SharedSessionContractImplementor session) {
return anyPart.forEachDisassembledJdbcValue( value, clause, offset, valuesConsumer, session );
}
@Override
public <T> DomainResult<T> createDomainResult(
NavigablePath navigablePath,

View File

@ -319,6 +319,16 @@ public class BasicEntityIdentifierMappingImpl implements BasicEntityIdentifierMa
// return propertyAccess.getGetter().get( value );
}
@Override
public int forEachDisassembledJdbcValue(
Object value,
Clause clause,
int offset,
JdbcValuesConsumer valuesConsumer,
SharedSessionContractImplementor session) {
return idType.forEachDisassembledJdbcValue( value, clause, offset, valuesConsumer, session );
}
@Override
public Fetch generateFetch(
FetchParent fetchParent,

View File

@ -18,6 +18,7 @@ import org.hibernate.metamodel.mapping.MappingType;
import org.hibernate.metamodel.model.domain.NavigableRole;
import org.hibernate.persister.collection.CollectionPersister;
import org.hibernate.query.NavigablePath;
import org.hibernate.sql.ast.Clause;
import org.hibernate.sql.ast.spi.FromClauseAccess;
import org.hibernate.sql.ast.spi.SqlAstCreationContext;
import org.hibernate.sql.ast.spi.SqlAstCreationState;
@ -253,4 +254,18 @@ public class CollectionIdentifierDescriptorImpl implements CollectionIdentifierD
return FetchTiming.IMMEDIATE;
}
@Override
public Object disassemble(Object value, SharedSessionContractImplementor session) {
return type.disassemble( value, session );
}
@Override
public int forEachDisassembledJdbcValue(
Object value,
Clause clause,
int offset,
JdbcValuesConsumer valuesConsumer,
SharedSessionContractImplementor session) {
return type.forEachDisassembledJdbcValue( value, clause, offset, valuesConsumer, session );
}
}

View File

@ -28,6 +28,7 @@ import org.hibernate.sql.ast.spi.SqlAliasBaseGenerator;
import org.hibernate.sql.ast.spi.SqlAstCreationContext;
import org.hibernate.sql.ast.spi.SqlExpressionResolver;
import org.hibernate.sql.ast.tree.from.StandardVirtualTableGroup;
import org.hibernate.sql.ast.Clause;
import org.hibernate.sql.ast.tree.from.TableGroup;
import org.hibernate.sql.ast.tree.from.TableGroupJoin;
import org.hibernate.sql.ast.tree.predicate.Predicate;
@ -188,6 +189,27 @@ public class DiscriminatedCollectionPart implements DiscriminatedAssociationMode
return getDiscriminatorPart().getJdbcTypeCount() + getKeyPart().getJdbcTypeCount();
}
@Override
public Object disassemble(Object value, SharedSessionContractImplementor session) {
return discriminatorMapping.getDiscriminatorPart().disassemble( value, session );
}
@Override
public int forEachDisassembledJdbcValue(
Object value,
Clause clause,
int offset,
JdbcValuesConsumer valuesConsumer,
SharedSessionContractImplementor session) {
return discriminatorMapping.getDiscriminatorPart().forEachDisassembledJdbcValue(
value,
clause,
offset,
valuesConsumer,
session
);
}
@Override
public void breakDownJdbcValues(Object domainValue, JdbcValueConsumer valueConsumer, SharedSessionContractImplementor session) {
discriminatorMapping.getDiscriminatorPart().breakDownJdbcValues( domainValue, valueConsumer, session );

View File

@ -17,6 +17,7 @@ import org.hibernate.metamodel.mapping.MappingType;
import org.hibernate.metamodel.mapping.SelectableMapping;
import org.hibernate.metamodel.model.domain.NavigableRole;
import org.hibernate.query.NavigablePath;
import org.hibernate.sql.ast.Clause;
import org.hibernate.sql.ast.spi.SqlAstCreationState;
import org.hibernate.sql.ast.spi.SqlExpressionResolver;
import org.hibernate.sql.ast.spi.SqlSelection;
@ -121,6 +122,21 @@ public class EntityRowIdMappingImpl implements EntityRowIdMapping, SelectableMap
return 1;
}
@Override
public Object disassemble(Object value, SharedSessionContractImplementor session) {
return rowIdType.disassemble( value, session );
}
@Override
public int forEachDisassembledJdbcValue(
Object value,
Clause clause,
int offset,
JdbcValuesConsumer valuesConsumer,
SharedSessionContractImplementor session) {
return rowIdType.forEachDisassembledJdbcValue( value, clause, offset, valuesConsumer, session );
}
@Override
public int forEachJdbcType(int offset, IndexedConsumer<JdbcMapping> action) {
action.accept( offset, getJdbcMapping() );

View File

@ -22,6 +22,7 @@ import org.hibernate.metamodel.mapping.JdbcMapping;
import org.hibernate.metamodel.mapping.MappingType;
import org.hibernate.metamodel.model.domain.NavigableRole;
import org.hibernate.query.NavigablePath;
import org.hibernate.sql.ast.Clause;
import org.hibernate.sql.ast.spi.SqlAstCreationState;
import org.hibernate.sql.ast.spi.SqlExpressionResolver;
import org.hibernate.sql.ast.spi.SqlSelection;
@ -279,4 +280,19 @@ public class EntityVersionMappingImpl implements EntityVersionMapping, FetchOpti
public FetchTiming getTiming() {
return FetchTiming.IMMEDIATE;
}
@Override
public Object disassemble(Object value, SharedSessionContractImplementor session) {
return versionBasicType.disassemble( value, session );
}
@Override
public int forEachDisassembledJdbcValue(
Object value,
Clause clause,
int offset,
JdbcValuesConsumer valuesConsumer,
SharedSessionContractImplementor session) {
return versionBasicType.forEachDisassembledJdbcValue( value, clause, offset, valuesConsumer, session );
}
}

View File

@ -41,6 +41,7 @@ import org.hibernate.persister.collection.CollectionPersister;
import org.hibernate.persister.entity.Joinable;
import org.hibernate.property.access.spi.PropertyAccess;
import org.hibernate.query.NavigablePath;
import org.hibernate.sql.ast.Clause;
import org.hibernate.sql.ast.SqlAstJoinType;
import org.hibernate.sql.ast.spi.FromClauseAccess;
import org.hibernate.sql.ast.spi.SqlAliasBase;
@ -781,18 +782,6 @@ 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 );
@ -887,6 +876,16 @@ public class PluralAttributeMappingImpl
return elementDescriptor.disassemble( value,session );
}
@Override
public int forEachDisassembledJdbcValue(
Object value,
Clause clause,
int offset,
JdbcValuesConsumer valuesConsumer,
SharedSessionContractImplementor session) {
return elementDescriptor.forEachDisassembledJdbcValue( value, clause, offset, valuesConsumer, session );
}
@Override
public int getNumberOfFetchables() {
return indexDescriptor == null ? 1 : 2;

View File

@ -25,6 +25,7 @@ import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.persister.entity.UniqueKeyLoadable;
import org.hibernate.proxy.HibernateProxy;
import org.hibernate.query.NavigablePath;
import org.hibernate.sql.ast.Clause;
import org.hibernate.sql.ast.tree.from.TableGroup;
import org.hibernate.sql.results.graph.AssemblerCreationState;
import org.hibernate.sql.results.graph.BiDirectionalFetch;
@ -181,6 +182,21 @@ public class CircularBiDirectionalFetchImpl implements BiDirectionalFetch, Assoc
throw new UnsupportedOperationException();
}
@Override
public Object disassemble(Object value, SharedSessionContractImplementor session) {
throw new UnsupportedOperationException();
}
@Override
public int forEachDisassembledJdbcValue(
Object value,
Clause clause,
int offset,
JdbcValuesConsumer valuesConsumer,
SharedSessionContractImplementor session) {
throw new UnsupportedOperationException();
}
private static class CircularFetchAssembler implements DomainResultAssembler<Object> {
private final NavigablePath circularPath;
private final JavaType<?> javaTypeDescriptor;

View File

@ -17,6 +17,7 @@ import org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping;
import org.hibernate.metamodel.model.domain.NavigableRole;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.query.NavigablePath;
import org.hibernate.sql.ast.Clause;
import org.hibernate.sql.ast.tree.from.TableGroup;
import org.hibernate.sql.results.graph.AssemblerCreationState;
import org.hibernate.sql.results.graph.BiDirectionalFetch;
@ -237,6 +238,21 @@ public class CircularFetchImpl implements BiDirectionalFetch, Association {
throw new UnsupportedOperationException();
}
@Override
public Object disassemble(Object value, SharedSessionContractImplementor session) {
throw new UnsupportedOperationException();
}
@Override
public int forEachDisassembledJdbcValue(
Object value,
Clause clause,
int offset,
JdbcValuesConsumer valuesConsumer,
SharedSessionContractImplementor session) {
throw new UnsupportedOperationException();
}
private static class BiDirectionalFetchAssembler implements DomainResultAssembler {
private EntityInitializer initializer;
private JavaType assembledJavaTypeDescriptor;