Remove ModelPart NotYetImplementedFor6Exception

This commit is contained in:
Andrea Boriero 2021-10-06 14:18:51 +02:00 committed by Christian Beikov
parent 0a41272e16
commit 2200a221a7
14 changed files with 168 additions and 38 deletions

View File

@ -9,7 +9,6 @@ package org.hibernate.metamodel.mapping;
import java.util.Objects;
import java.util.function.BiConsumer;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.metamodel.model.domain.NavigableRole;
import org.hibernate.query.NavigablePath;
@ -76,23 +75,19 @@ public interface ModelPart extends MappingModelExpressable {
/**
* Apply SQL selections for a specific reference to this ModelPart outside the domain query's root select clause.
*/
default void applySqlSelections(
void applySqlSelections(
NavigablePath navigablePath,
TableGroup tableGroup,
DomainResultCreationState creationState) {
throw new NotYetImplementedFor6Exception( getClass() );
}
DomainResultCreationState creationState);
/**
* Apply SQL selections for a specific reference to this ModelPart outside the domain query's root select clause.
*/
default void applySqlSelections(
void applySqlSelections(
NavigablePath navigablePath,
TableGroup tableGroup,
DomainResultCreationState creationState,
BiConsumer<SqlSelection,JdbcMapping> selectionConsumer) {
throw new NotYetImplementedFor6Exception( getClass() );
}
BiConsumer<SqlSelection,JdbcMapping> selectionConsumer);
default int forEachSelectable(SelectableConsumer consumer) {
return forEachSelectable( 0, consumer );

View File

@ -7,6 +7,7 @@
package org.hibernate.metamodel.mapping.internal;
import java.io.Serializable;
import java.util.function.BiConsumer;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.engine.FetchStyle;
@ -138,6 +139,21 @@ public class AnyDiscriminatorPart implements BasicValuedModelPart, FetchOptions,
throw new NotYetImplementedFor6Exception( getClass() );
}
@Override
public void applySqlSelections(
NavigablePath navigablePath, TableGroup tableGroup, DomainResultCreationState creationState) {
throw new NotYetImplementedFor6Exception( getClass() );
}
@Override
public void applySqlSelections(
NavigablePath navigablePath,
TableGroup tableGroup,
DomainResultCreationState creationState,
BiConsumer<SqlSelection, JdbcMapping> selectionConsumer) {
throw new NotYetImplementedFor6Exception( getClass() );
}
@Override
public Object disassemble(Object value, SharedSessionContractImplementor session) {
final Serializable discriminator = metaType.disassemble( value, session, value );

View File

@ -8,6 +8,7 @@ package org.hibernate.metamodel.mapping.internal;
import java.util.Collections;
import java.util.List;
import java.util.function.BiConsumer;
import org.hibernate.engine.FetchStyle;
import org.hibernate.engine.FetchTiming;
@ -250,4 +251,21 @@ public class AnyKeyPart implements BasicValuedModelPart, FetchOptions {
DomainResultCreationState creationState) {
return anyPart.createDomainResult( navigablePath, tableGroup, resultVariable, creationState );
}
@Override
public void applySqlSelections(
NavigablePath navigablePath,
TableGroup tableGroup,
DomainResultCreationState creationState) {
anyPart.applySqlSelections( navigablePath, tableGroup, creationState );
}
@Override
public void applySqlSelections(
NavigablePath navigablePath,
TableGroup tableGroup,
DomainResultCreationState creationState,
BiConsumer<SqlSelection, JdbcMapping> selectionConsumer) {
anyPart.applySqlSelections( navigablePath, tableGroup, creationState, selectionConsumer );
}
}

View File

@ -6,6 +6,8 @@
*/
package org.hibernate.metamodel.mapping.internal;
import java.util.function.BiConsumer;
import org.hibernate.engine.FetchStyle;
import org.hibernate.engine.FetchTiming;
import org.hibernate.engine.spi.SessionFactoryImplementor;
@ -127,6 +129,28 @@ public class CollectionIdentifierDescriptorImpl implements CollectionIdentifierD
);
}
@Override
public void applySqlSelections(
NavigablePath navigablePath,
TableGroup tableGroup,
DomainResultCreationState creationState) {
collectionDescriptor.getAttributeMapping().applySqlSelections( navigablePath, tableGroup, creationState );
}
@Override
public void applySqlSelections(
NavigablePath navigablePath,
TableGroup tableGroup,
DomainResultCreationState creationState,
BiConsumer<SqlSelection, JdbcMapping> selectionConsumer) {
collectionDescriptor.getAttributeMapping().applySqlSelections(
navigablePath,
tableGroup,
creationState,
selectionConsumer
);
}
@Override
public void breakDownJdbcValues(Object domainValue, JdbcValueConsumer valueConsumer, SharedSessionContractImplementor session) {
valueConsumer.consume( domainValue, this );

View File

@ -6,6 +6,7 @@
*/
package org.hibernate.metamodel.mapping.internal;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import org.hibernate.engine.FetchTiming;
@ -29,6 +30,7 @@ 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.spi.SqlSelection;
import org.hibernate.sql.ast.tree.from.TableGroup;
import org.hibernate.sql.ast.tree.from.TableGroupJoin;
import org.hibernate.sql.ast.tree.predicate.Predicate;
@ -143,6 +145,23 @@ public class DiscriminatedCollectionPart implements DiscriminatedAssociationMode
);
}
@Override
public void applySqlSelections(
NavigablePath navigablePath,
TableGroup tableGroup,
DomainResultCreationState creationState) {
discriminatorMapping.getDiscriminatorPart().applySqlSelections( navigablePath, tableGroup, creationState );
}
@Override
public void applySqlSelections(
NavigablePath navigablePath,
TableGroup tableGroup,
DomainResultCreationState creationState,
BiConsumer<SqlSelection, JdbcMapping> selectionConsumer) {
discriminatorMapping.getDiscriminatorPart().applySqlSelections( navigablePath, tableGroup, creationState, selectionConsumer );
}
@Override
public MappingType getPartMappingType() {
return discriminatorMapping;

View File

@ -8,6 +8,7 @@ package org.hibernate.metamodel.mapping.internal;
import java.util.ArrayList;
import java.util.List;
import java.util.function.BiConsumer;
import java.util.function.IntFunction;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
@ -35,6 +36,7 @@ import org.hibernate.sql.ast.Clause;
import org.hibernate.sql.ast.SqlAstJoinType;
import org.hibernate.sql.ast.spi.SqlAstCreationContext;
import org.hibernate.sql.ast.spi.SqlExpressionResolver;
import org.hibernate.sql.ast.spi.SqlSelection;
import org.hibernate.sql.ast.tree.expression.ColumnReference;
import org.hibernate.sql.ast.tree.expression.Expression;
import org.hibernate.sql.ast.tree.from.TableGroup;
@ -280,6 +282,23 @@ public class EmbeddedForeignKeyDescriptor implements ForeignKeyDescriptor {
return createDomainResult( navigablePath, tableGroup, resultVariable, keyTable, keySide.getModelPart(), creationState );
}
@Override
public void applySqlSelections(
NavigablePath navigablePath,
TableGroup tableGroup,
DomainResultCreationState creationState) {
throw new UnsupportedOperationException();
}
@Override
public void applySqlSelections(
NavigablePath navigablePath,
TableGroup tableGroup,
DomainResultCreationState creationState,
BiConsumer<SqlSelection, JdbcMapping> selectionConsumer) {
throw new UnsupportedOperationException();
}
private <T> DomainResult<T> createDomainResult(
NavigablePath navigablePath,
TableGroup tableGroup,

View File

@ -8,6 +8,7 @@ package org.hibernate.metamodel.mapping.internal;
import java.util.Collections;
import java.util.List;
import java.util.function.BiConsumer;
import java.util.function.IntFunction;
import org.hibernate.engine.FetchStyle;
@ -205,6 +206,23 @@ public class SimpleForeignKeyDescriptor implements ForeignKeyDescriptor, BasicVa
return createDomainResult( navigablePath, tableGroup, keySide.getModelPart(), creationState );
}
@Override
public void applySqlSelections(
NavigablePath navigablePath,
TableGroup tableGroup,
DomainResultCreationState creationState) {
throw new UnsupportedOperationException();
}
@Override
public void applySqlSelections(
NavigablePath navigablePath,
TableGroup tableGroup,
DomainResultCreationState creationState,
BiConsumer<SqlSelection, JdbcMapping> selectionConsumer) {
throw new UnsupportedOperationException();
}
private <T> DomainResult<T> createDomainResult(
NavigablePath navigablePath,
TableGroup tableGroup,

View File

@ -6,11 +6,7 @@
*/
package org.hibernate.metamodel.relational;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.annotations.ColumnTransformer;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.metamodel.mapping.JdbcMapping;
import org.hibernate.sql.ast.tree.from.ColumnReferenceQualifier;
/**
* @author Steve Ebersole
@ -21,20 +17,4 @@ public interface Column {
Table getTable();
JdbcMapping getJdbcMapping();
/**
* Render this Column's expression for reading accounting for any
* configured {@link ColumnTransformer#read()}
*/
default String renderForRead(ColumnReferenceQualifier qualifier, SessionFactoryImplementor sessionFactory) {
throw new NotYetImplementedFor6Exception( getClass() );
}
/**
* Render this Column's expression for reading accounting for any
* configured {@link ColumnTransformer#write()}
*/
default String renderForWrite(SessionFactoryImplementor sessionFactory) {
throw new NotYetImplementedFor6Exception( getClass() );
}
}

View File

@ -15,7 +15,6 @@ import java.util.function.Consumer;
import org.hibernate.Filter;
import org.hibernate.HibernateException;
import org.hibernate.MappingException;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.cache.spi.access.CollectionDataAccess;
import org.hibernate.cache.spi.entry.CacheEntryStructure;
import org.hibernate.collection.spi.CollectionSemantics;
@ -356,13 +355,8 @@ public interface CollectionPersister extends CollectionDefinition, Restrictable
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// mapping model
default CollectionSemantics getCollectionSemantics() {
throw new NotYetImplementedFor6Exception(
"The persister used for this collection [" + getNavigableRole()
+ "] does not yet implement support for `"
+ CollectionSemantics.class.getName() + "`"
);
}
CollectionSemantics getCollectionSemantics();
void applyBaseManyToManyRestrictions(
Consumer<Predicate> predicateConsumer,

View File

@ -5,6 +5,7 @@
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.persister.collection;
import org.hibernate.FetchMode;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.persister.entity.Joinable;

View File

@ -6,6 +6,8 @@
*/
package org.hibernate.sql.results.internal.domain;
import java.util.function.BiConsumer;
import org.hibernate.LockMode;
import org.hibernate.engine.FetchTiming;
import org.hibernate.engine.spi.CollectionKey;
@ -28,6 +30,7 @@ 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.spi.SqlSelection;
import org.hibernate.sql.ast.tree.from.TableGroup;
import org.hibernate.sql.results.graph.AssemblerCreationState;
import org.hibernate.sql.results.graph.BiDirectionalFetch;
@ -354,4 +357,21 @@ public class CircularBiDirectionalFetchImpl implements BiDirectionalFetch, Assoc
DomainResultCreationState creationState) {
return fetchable.createDomainResult( navigablePath, tableGroup, resultVariable, creationState );
}
@Override
public void applySqlSelections(
NavigablePath navigablePath,
TableGroup tableGroup,
DomainResultCreationState creationState) {
fetchable.applySqlSelections( navigablePath, tableGroup, creationState );
}
@Override
public void applySqlSelections(
NavigablePath navigablePath,
TableGroup tableGroup,
DomainResultCreationState creationState,
BiConsumer<SqlSelection, JdbcMapping> selectionConsumer) {
fetchable.applySqlSelections( navigablePath, tableGroup, creationState, selectionConsumer );
}
}

View File

@ -6,6 +6,8 @@
*/
package org.hibernate.sql.results.internal.domain;
import java.util.function.BiConsumer;
import org.hibernate.engine.FetchTiming;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.mapping.IndexedConsumer;
@ -20,6 +22,7 @@ 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.spi.SqlSelection;
import org.hibernate.sql.ast.tree.from.TableGroup;
import org.hibernate.sql.results.graph.AssemblerCreationState;
import org.hibernate.sql.results.graph.BiDirectionalFetch;
@ -199,6 +202,23 @@ public class CircularFetchImpl implements BiDirectionalFetch, Association {
return fetchable.createDomainResult( navigablePath, tableGroup,resultVariable, creationState );
}
@Override
public void applySqlSelections(
NavigablePath navigablePath,
TableGroup tableGroup,
DomainResultCreationState creationState) {
fetchable.applySqlSelections( navigablePath, tableGroup, creationState );
}
@Override
public void applySqlSelections(
NavigablePath navigablePath,
TableGroup tableGroup,
DomainResultCreationState creationState,
BiConsumer<SqlSelection, JdbcMapping> selectionConsumer) {
fetchable.applySqlSelections( navigablePath, tableGroup, creationState, selectionConsumer );
}
@Override
public EntityMappingType findContainingEntityMapping() {
return fetchable.findContainingEntityMapping();

View File

@ -26,6 +26,7 @@ import org.hibernate.cache.spi.access.NaturalIdDataAccess;
import org.hibernate.cache.spi.entry.CacheEntry;
import org.hibernate.cache.spi.entry.CacheEntryStructure;
import org.hibernate.cfg.NotYetImplementedException;
import org.hibernate.collection.spi.CollectionSemantics;
import org.hibernate.collection.spi.PersistentCollection;
import org.hibernate.engine.internal.MutableEntityEntryFactory;
import org.hibernate.engine.spi.CascadeStyle;
@ -960,6 +961,11 @@ public class GoofyPersisterClassProvider implements PersisterClassResolver {
return null;
}
@Override
public CollectionSemantics getCollectionSemantics() {
return null;
}
@Override
public void applyBaseManyToManyRestrictions(Consumer<Predicate> predicateConsumer, TableGroup tableGroup, boolean useQualifier, Map<String, Filter> enabledFilters, Set<String> treatAsDeclarations, SqlAstCreationState creationState) {