remove SQLLoadable and SQLLoadableCollection
and some obsolete related code Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
parent
efd2e90f5f
commit
4013246d75
|
@ -81,7 +81,6 @@ import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
|
||||||
import org.hibernate.persister.collection.AbstractCollectionPersister;
|
import org.hibernate.persister.collection.AbstractCollectionPersister;
|
||||||
import org.hibernate.persister.collection.CollectionPersister;
|
import org.hibernate.persister.collection.CollectionPersister;
|
||||||
import org.hibernate.persister.collection.QueryableCollection;
|
import org.hibernate.persister.collection.QueryableCollection;
|
||||||
import org.hibernate.persister.collection.SQLLoadableCollection;
|
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
import org.hibernate.persister.entity.Joinable;
|
import org.hibernate.persister.entity.Joinable;
|
||||||
import org.hibernate.property.access.internal.ChainedPropertyAccessImpl;
|
import org.hibernate.property.access.internal.ChainedPropertyAccessImpl;
|
||||||
|
@ -565,8 +564,7 @@ public class MappingModelCreationHelper {
|
||||||
|
|
||||||
indexDescriptor = null;
|
indexDescriptor = null;
|
||||||
|
|
||||||
assert collectionDescriptor instanceof SQLLoadableCollection;
|
final QueryableCollection loadableCollection = (QueryableCollection) collectionDescriptor;
|
||||||
final SQLLoadableCollection loadableCollection = (SQLLoadableCollection) collectionDescriptor;
|
|
||||||
final String identifierColumnName = loadableCollection.getIdentifierColumnName();
|
final String identifierColumnName = loadableCollection.getIdentifierColumnName();
|
||||||
assert identifierColumnName != null;
|
assert identifierColumnName != null;
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@ import org.hibernate.Internal;
|
||||||
import org.hibernate.LockOptions;
|
import org.hibernate.LockOptions;
|
||||||
import org.hibernate.MappingException;
|
import org.hibernate.MappingException;
|
||||||
import org.hibernate.QueryException;
|
import org.hibernate.QueryException;
|
||||||
import org.hibernate.Remove;
|
|
||||||
import org.hibernate.TransientObjectException;
|
import org.hibernate.TransientObjectException;
|
||||||
import org.hibernate.annotations.CacheLayout;
|
import org.hibernate.annotations.CacheLayout;
|
||||||
import org.hibernate.boot.spi.MetadataImplementor;
|
import org.hibernate.boot.spi.MetadataImplementor;
|
||||||
|
@ -871,24 +870,6 @@ public abstract class AbstractCollectionPersister
|
||||||
protected abstract RowMutationOperations getRowMutationOperations();
|
protected abstract RowMutationOperations getRowMutationOperations();
|
||||||
protected abstract RemoveCoordinator getRemoveCoordinator();
|
protected abstract RemoveCoordinator getRemoveCoordinator();
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getSQLOrderByString(String alias) {
|
|
||||||
if ( hasOrdering() ) {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getManyToManyOrderByString(String alias) {
|
|
||||||
if ( hasManyToManyOrdering() ) {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FetchMode getFetchMode() {
|
public FetchMode getFetchMode() {
|
||||||
return fetchMode;
|
return fetchMode;
|
||||||
|
|
|
@ -10,9 +10,5 @@ package org.hibernate.persister.collection;
|
||||||
* @deprecated Just used to singly extend all the deprecated collection persister roles
|
* @deprecated Just used to singly extend all the deprecated collection persister roles
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public interface DeprecatedCollectionStuff extends SQLLoadableCollection {
|
public interface DeprecatedCollectionStuff extends QueryableCollection {
|
||||||
@Override
|
|
||||||
default String getRole() {
|
|
||||||
return SQLLoadableCollection.super.getRole();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,18 +53,10 @@ public interface QueryableCollection extends PropertyMapping, Joinable, Collecti
|
||||||
* key columns in the case of a one-to-many association)
|
* key columns in the case of a one-to-many association)
|
||||||
*/
|
*/
|
||||||
String[] getElementColumnNames();
|
String[] getElementColumnNames();
|
||||||
/**
|
|
||||||
* Get the order by SQL
|
|
||||||
*/
|
|
||||||
String getSQLOrderByString(String alias);
|
|
||||||
|
|
||||||
/**
|
String getIdentifierColumnName();
|
||||||
* Get the order-by to be applied at the target table of a many to many
|
|
||||||
*
|
String[] getCollectionPropertyColumnAliases(String propertyName, String string);
|
||||||
* @param alias The alias for the many-to-many target table
|
|
||||||
* @return appropriate order-by fragment or empty string.
|
|
||||||
*/
|
|
||||||
String getManyToManyOrderByString(String alias);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does this collection role have a where clause filter?
|
* Does this collection role have a where clause filter?
|
||||||
|
@ -81,5 +73,4 @@ public interface QueryableCollection extends PropertyMapping, Joinable, Collecti
|
||||||
* Should we load this collection role by outerjoining?
|
* Should we load this collection role by outerjoining?
|
||||||
*/
|
*/
|
||||||
FetchMode getFetchMode();
|
FetchMode getFetchMode();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
/*
|
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
|
||||||
*
|
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
|
||||||
*/
|
|
||||||
package org.hibernate.persister.collection;
|
|
||||||
|
|
||||||
|
|
||||||
@Deprecated( since = "6" )
|
|
||||||
public interface SQLLoadableCollection extends QueryableCollection {
|
|
||||||
|
|
||||||
String[] getCollectionPropertyColumnAliases(String propertyName, String string);
|
|
||||||
|
|
||||||
String getIdentifierColumnName();
|
|
||||||
|
|
||||||
}
|
|
|
@ -78,7 +78,6 @@ import org.hibernate.engine.internal.CacheHelper;
|
||||||
import org.hibernate.engine.internal.ImmutableEntityEntryFactory;
|
import org.hibernate.engine.internal.ImmutableEntityEntryFactory;
|
||||||
import org.hibernate.engine.internal.MutableEntityEntryFactory;
|
import org.hibernate.engine.internal.MutableEntityEntryFactory;
|
||||||
import org.hibernate.engine.internal.StatefulPersistenceContext;
|
import org.hibernate.engine.internal.StatefulPersistenceContext;
|
||||||
import org.hibernate.engine.jdbc.mutation.spi.MutationExecutorService;
|
|
||||||
import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
|
import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
|
||||||
import org.hibernate.engine.profile.internal.FetchProfileAffectee;
|
import org.hibernate.engine.profile.internal.FetchProfileAffectee;
|
||||||
import org.hibernate.engine.spi.CachedNaturalIdValueSource;
|
import org.hibernate.engine.spi.CachedNaturalIdValueSource;
|
||||||
|
@ -237,7 +236,6 @@ import org.hibernate.query.sqm.mutation.spi.SqmMultiTableMutationStrategyProvide
|
||||||
import org.hibernate.service.ServiceRegistry;
|
import org.hibernate.service.ServiceRegistry;
|
||||||
import org.hibernate.spi.NavigablePath;
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.sql.Alias;
|
import org.hibernate.sql.Alias;
|
||||||
import org.hibernate.sql.Delete;
|
|
||||||
import org.hibernate.sql.InFragment;
|
import org.hibernate.sql.InFragment;
|
||||||
import org.hibernate.sql.SimpleSelect;
|
import org.hibernate.sql.SimpleSelect;
|
||||||
import org.hibernate.sql.Template;
|
import org.hibernate.sql.Template;
|
||||||
|
@ -308,7 +306,6 @@ import static org.hibernate.engine.internal.ManagedTypeHelper.isPersistentAttrib
|
||||||
import static org.hibernate.engine.internal.ManagedTypeHelper.processIfManagedEntity;
|
import static org.hibernate.engine.internal.ManagedTypeHelper.processIfManagedEntity;
|
||||||
import static org.hibernate.engine.internal.ManagedTypeHelper.processIfPersistentAttributeInterceptable;
|
import static org.hibernate.engine.internal.ManagedTypeHelper.processIfPersistentAttributeInterceptable;
|
||||||
import static org.hibernate.engine.internal.ManagedTypeHelper.processIfSelfDirtinessTracker;
|
import static org.hibernate.engine.internal.ManagedTypeHelper.processIfSelfDirtinessTracker;
|
||||||
import static org.hibernate.engine.internal.Versioning.isVersionIncrementRequired;
|
|
||||||
import static org.hibernate.generator.EventType.INSERT;
|
import static org.hibernate.generator.EventType.INSERT;
|
||||||
import static org.hibernate.generator.EventType.UPDATE;
|
import static org.hibernate.generator.EventType.UPDATE;
|
||||||
import static org.hibernate.internal.util.ReflectHelper.isAbstractClass;
|
import static org.hibernate.internal.util.ReflectHelper.isAbstractClass;
|
||||||
|
@ -324,7 +321,6 @@ import static org.hibernate.internal.util.collections.ArrayHelper.toTypeArray;
|
||||||
import static org.hibernate.internal.util.collections.CollectionHelper.combine;
|
import static org.hibernate.internal.util.collections.CollectionHelper.combine;
|
||||||
import static org.hibernate.internal.util.collections.CollectionHelper.isNotEmpty;
|
import static org.hibernate.internal.util.collections.CollectionHelper.isNotEmpty;
|
||||||
import static org.hibernate.internal.util.collections.CollectionHelper.setOfSize;
|
import static org.hibernate.internal.util.collections.CollectionHelper.setOfSize;
|
||||||
import static org.hibernate.internal.util.collections.CollectionHelper.toSmallList;
|
|
||||||
import static org.hibernate.loader.ast.internal.MultiKeyLoadHelper.supportsSqlArrayType;
|
import static org.hibernate.loader.ast.internal.MultiKeyLoadHelper.supportsSqlArrayType;
|
||||||
import static org.hibernate.metamodel.RepresentationMode.POJO;
|
import static org.hibernate.metamodel.RepresentationMode.POJO;
|
||||||
import static org.hibernate.persister.entity.DiscriminatorHelper.NOT_NULL_DISCRIMINATOR;
|
import static org.hibernate.persister.entity.DiscriminatorHelper.NOT_NULL_DISCRIMINATOR;
|
||||||
|
@ -386,8 +382,6 @@ public abstract class AbstractEntityPersister
|
||||||
private final boolean[][] propertyColumnInsertable;
|
private final boolean[][] propertyColumnInsertable;
|
||||||
private final Set<String> sharedColumnNames;
|
private final Set<String> sharedColumnNames;
|
||||||
|
|
||||||
private final List<Integer> lobProperties;
|
|
||||||
|
|
||||||
//information about lazy properties of this class
|
//information about lazy properties of this class
|
||||||
private final String[] lazyPropertyNames;
|
private final String[] lazyPropertyNames;
|
||||||
private final int[] lazyPropertyNumbers;
|
private final int[] lazyPropertyNumbers;
|
||||||
|
@ -443,10 +437,6 @@ public abstract class AbstractEntityPersister
|
||||||
private GeneratedValuesMutationDelegate updateDelegate;
|
private GeneratedValuesMutationDelegate updateDelegate;
|
||||||
private String identitySelectString;
|
private String identitySelectString;
|
||||||
|
|
||||||
private boolean[] tableHasColumns;
|
|
||||||
|
|
||||||
private final Map<String,String[]> subclassPropertyColumnNames = new HashMap<>();
|
|
||||||
|
|
||||||
private final JavaType<?> javaType;
|
private final JavaType<?> javaType;
|
||||||
private final EntityRepresentationStrategy representationStrategy;
|
private final EntityRepresentationStrategy representationStrategy;
|
||||||
|
|
||||||
|
@ -648,7 +638,6 @@ public abstract class AbstractEntityPersister
|
||||||
final ArrayList<Type> lazyTypes = new ArrayList<>();
|
final ArrayList<Type> lazyTypes = new ArrayList<>();
|
||||||
final ArrayList<String[]> lazyColAliases = new ArrayList<>();
|
final ArrayList<String[]> lazyColAliases = new ArrayList<>();
|
||||||
|
|
||||||
final ArrayList<Integer> lobPropertiesLocalCollector = new ArrayList<>();
|
|
||||||
final List<Property> propertyClosure = persistentClass.getPropertyClosure();
|
final List<Property> propertyClosure = persistentClass.getPropertyClosure();
|
||||||
boolean foundFormula = false;
|
boolean foundFormula = false;
|
||||||
for ( int i = 0; i < propertyClosure.size(); i++ ) {
|
for ( int i = 0; i < propertyClosure.size(); i++ ) {
|
||||||
|
@ -709,12 +698,7 @@ public abstract class AbstractEntityPersister
|
||||||
|
|
||||||
propertyColumnUpdateable[i] = prop.getValue().getColumnUpdateability();
|
propertyColumnUpdateable[i] = prop.getValue().getColumnUpdateability();
|
||||||
propertyColumnInsertable[i] = prop.getValue().getColumnInsertability();
|
propertyColumnInsertable[i] = prop.getValue().getColumnInsertability();
|
||||||
|
|
||||||
if ( prop.isLob() && dialect.forceLobAsLastValue() ) {
|
|
||||||
lobPropertiesLocalCollector.add( i );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
lobProperties = toSmallList( lobPropertiesLocalCollector );
|
|
||||||
hasFormulaProperties = foundFormula;
|
hasFormulaProperties = foundFormula;
|
||||||
lazyPropertyColumnAliases = to2DStringArray( lazyColAliases );
|
lazyPropertyColumnAliases = to2DStringArray( lazyColAliases );
|
||||||
lazyPropertyNames = toStringArray( lazyNames );
|
lazyPropertyNames = toStringArray( lazyNames );
|
||||||
|
@ -1083,10 +1067,6 @@ public abstract class AbstractEntityPersister
|
||||||
return sharedColumnNames.contains( columnExpression );
|
return sharedColumnNames.contains( columnExpression );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean[] getTableHasColumns() {
|
|
||||||
return tableHasColumns;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getRootTableKeyColumnNames() {
|
public String[] getRootTableKeyColumnNames() {
|
||||||
return rootTableKeyColumnNames;
|
return rootTableKeyColumnNames;
|
||||||
|
@ -2648,12 +2628,6 @@ public abstract class AbstractEntityPersister
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String[] getSubclassPropertyColumnNames(String propertyName) {
|
|
||||||
//TODO: should we allow suffixes on these ?
|
|
||||||
return subclassPropertyColumnNames.get( propertyName );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object loadByUniqueKey(
|
public Object loadByUniqueKey(
|
||||||
String propertyName,
|
String propertyName,
|
||||||
|
@ -3439,13 +3413,6 @@ public abstract class AbstractEntityPersister
|
||||||
|
|
||||||
final int joinSpan = getTableSpan();
|
final int joinSpan = getTableSpan();
|
||||||
|
|
||||||
tableHasColumns = new boolean[joinSpan];
|
|
||||||
for ( int j = 0; j < joinSpan; j++ ) {
|
|
||||||
final String tableName = getTableName( j );
|
|
||||||
final EntityTableMapping tableMapping = findTableMapping( tableName );
|
|
||||||
tableHasColumns[j] = tableMapping.hasColumns();
|
|
||||||
}
|
|
||||||
|
|
||||||
//select SQL
|
//select SQL
|
||||||
sqlVersionSelectString = generateSelectVersionString();
|
sqlVersionSelectString = generateSelectVersionString();
|
||||||
}
|
}
|
||||||
|
@ -4313,11 +4280,6 @@ public abstract class AbstractEntityPersister
|
||||||
return propertyMapping.toType( propertyName );
|
return propertyMapping.toType( propertyName );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Type getType() {
|
|
||||||
return entityMetamodel.getEntityType();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSelectBeforeUpdateRequired() {
|
public boolean isSelectBeforeUpdateRequired() {
|
||||||
return entityMetamodel.isSelectBeforeUpdate();
|
return entityMetamodel.isSelectBeforeUpdate();
|
||||||
|
@ -6423,13 +6385,11 @@ public abstract class AbstractEntityPersister
|
||||||
// aliases for identifier ( alias.id ); skip if the entity defines a non-id property named 'id'
|
// aliases for identifier ( alias.id ); skip if the entity defines a non-id property named 'id'
|
||||||
if ( !entityMetamodel.hasNonIdentifierPropertyNamedId() ) {
|
if ( !entityMetamodel.hasNonIdentifierPropertyNamedId() ) {
|
||||||
subclassPropertyAliases.put( ENTITY_ID, getIdentifierAliases() );
|
subclassPropertyAliases.put( ENTITY_ID, getIdentifierAliases() );
|
||||||
subclassPropertyColumnNames.put( ENTITY_ID, getIdentifierColumnNames() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// aliases named identifier ( alias.idname )
|
// aliases named identifier ( alias.idname )
|
||||||
if ( hasIdentifierProperty() ) {
|
if ( hasIdentifierProperty() ) {
|
||||||
subclassPropertyAliases.put( getIdentifierPropertyName(), getIdentifierAliases() );
|
subclassPropertyAliases.put( getIdentifierPropertyName(), getIdentifierAliases() );
|
||||||
subclassPropertyColumnNames.put( getIdentifierPropertyName(), getIdentifierColumnNames() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// aliases for composite-id's
|
// aliases for composite-id's
|
||||||
|
@ -6446,10 +6406,6 @@ public abstract class AbstractEntityPersister
|
||||||
ENTITY_ID + "." + idPropertyNames[i],
|
ENTITY_ID + "." + idPropertyNames[i],
|
||||||
new String[] {idAliases[i]}
|
new String[] {idAliases[i]}
|
||||||
);
|
);
|
||||||
subclassPropertyColumnNames.put(
|
|
||||||
ENTITY_ID + "." + getIdentifierPropertyName() + "." + idPropertyNames[i],
|
|
||||||
new String[] {idColumnNames[i]}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
// if (hasIdentifierProperty() && !ENTITY_ID.equals( getIdentifierPropertyNames() ) ) {
|
// if (hasIdentifierProperty() && !ENTITY_ID.equals( getIdentifierPropertyNames() ) ) {
|
||||||
if ( hasIdentifierProperty() ) {
|
if ( hasIdentifierProperty() ) {
|
||||||
|
@ -6457,22 +6413,16 @@ public abstract class AbstractEntityPersister
|
||||||
getIdentifierPropertyName() + "." + idPropertyNames[i],
|
getIdentifierPropertyName() + "." + idPropertyNames[i],
|
||||||
new String[] {idAliases[i]}
|
new String[] {idAliases[i]}
|
||||||
);
|
);
|
||||||
subclassPropertyColumnNames.put(
|
|
||||||
getIdentifierPropertyName() + "." + idPropertyNames[i],
|
|
||||||
new String[] {idColumnNames[i]}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// embedded composite ids ( alias.idName1, alias.idName2 )
|
// embedded composite ids ( alias.idName1, alias.idName2 )
|
||||||
subclassPropertyAliases.put( idPropertyNames[i], new String[] {idAliases[i]} );
|
subclassPropertyAliases.put( idPropertyNames[i], new String[] {idAliases[i]} );
|
||||||
subclassPropertyColumnNames.put( idPropertyNames[i], new String[] {idColumnNames[i]} );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( entityMetamodel.isPolymorphic() ) {
|
if ( entityMetamodel.isPolymorphic() ) {
|
||||||
subclassPropertyAliases.put( ENTITY_CLASS, new String[] {getDiscriminatorAlias()} );
|
subclassPropertyAliases.put( ENTITY_CLASS, new String[] {getDiscriminatorAlias()} );
|
||||||
subclassPropertyColumnNames.put( ENTITY_CLASS, new String[] {getDiscriminatorColumnName()} );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6496,7 +6446,6 @@ public abstract class AbstractEntityPersister
|
||||||
}
|
}
|
||||||
|
|
||||||
subclassPropertyAliases.put( name, aliases );
|
subclassPropertyAliases.put( name, aliases );
|
||||||
subclassPropertyColumnNames.put( name, cols );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,5 +12,5 @@ package org.hibernate.persister.entity;
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public interface DeprecatedEntityStuff
|
public interface DeprecatedEntityStuff
|
||||||
extends OuterJoinLoadable, UniqueKeyLoadable, SQLLoadable, Lockable, Queryable {
|
extends OuterJoinLoadable, UniqueKeyLoadable, Loadable, Lockable, Queryable {
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,15 +92,6 @@ public interface Loadable extends EntityPersister {
|
||||||
|
|
||||||
boolean isAbstract();
|
boolean isAbstract();
|
||||||
|
|
||||||
/**
|
|
||||||
* Register the name of a fetch profile determined to have an affect on the
|
|
||||||
* underlying loadable in regards to the fact that the underlying load SQL
|
|
||||||
* needs to be adjust when the given fetch profile is enabled.
|
|
||||||
*
|
|
||||||
* @param fetchProfileName The name of the profile affecting this.
|
|
||||||
*/
|
|
||||||
void registerAffectingFetchProfile(String fetchProfileName);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a column name and the root table alias in use for the entity hierarchy, determine the proper table alias
|
* Given a column name and the root table alias in use for the entity hierarchy, determine the proper table alias
|
||||||
* for the table in that hierarchy that contains said column.
|
* for the table in that hierarchy that contains said column.
|
||||||
|
@ -114,4 +105,14 @@ public interface Loadable extends EntityPersister {
|
||||||
* @return The proper table alias for qualifying the given column.
|
* @return The proper table alias for qualifying the given column.
|
||||||
*/
|
*/
|
||||||
String getTableAliasForColumn(String columnName, String rootAlias);
|
String getTableAliasForColumn(String columnName, String rootAlias);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* All columns to select, when loading.
|
||||||
|
*/
|
||||||
|
String selectFragment(String alias, String suffix);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the column alias names used to persist/query the named property of the class or a subclass (optional operation).
|
||||||
|
*/
|
||||||
|
String[] getSubclassPropertyColumnAliases(String propertyName, String suffix);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
/*
|
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
|
||||||
*
|
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
|
||||||
*/
|
|
||||||
package org.hibernate.persister.entity;
|
|
||||||
|
|
||||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
|
||||||
import org.hibernate.type.Type;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An {@link EntityPersister} that supports queries expressed
|
|
||||||
* in the platform native SQL dialect.
|
|
||||||
*
|
|
||||||
* @author Gavin King, Max Andersen
|
|
||||||
*
|
|
||||||
* @deprecated Use {@link EntityMappingType}
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6", forRemoval = true)
|
|
||||||
public interface SQLLoadable extends Loadable {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the column alias names used to persist/query the named property of the class or a subclass (optional operation).
|
|
||||||
*/
|
|
||||||
String[] getSubclassPropertyColumnAliases(String propertyName, String suffix);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the column names used to persist/query the named property of the class or a subclass (optional operation).
|
|
||||||
*/
|
|
||||||
String[] getSubclassPropertyColumnNames(String propertyName);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* All columns to select, when loading.
|
|
||||||
*/
|
|
||||||
String selectFragment(String alias, String suffix);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the type
|
|
||||||
*/
|
|
||||||
Type getType();
|
|
||||||
|
|
||||||
}
|
|
|
@ -33,7 +33,6 @@ import org.hibernate.dialect.Dialect;
|
||||||
import org.hibernate.id.IdentityGenerator;
|
import org.hibernate.id.IdentityGenerator;
|
||||||
import org.hibernate.internal.FilterAliasGenerator;
|
import org.hibernate.internal.FilterAliasGenerator;
|
||||||
import org.hibernate.internal.StaticFilterAliasGenerator;
|
import org.hibernate.internal.StaticFilterAliasGenerator;
|
||||||
import org.hibernate.internal.util.collections.ArrayHelper;
|
|
||||||
import org.hibernate.internal.util.collections.JoinedList;
|
import org.hibernate.internal.util.collections.JoinedList;
|
||||||
import org.hibernate.jdbc.Expectation;
|
import org.hibernate.jdbc.Expectation;
|
||||||
import org.hibernate.mapping.Column;
|
import org.hibernate.mapping.Column;
|
||||||
|
@ -446,10 +445,6 @@ public class UnionSubclassEntityPersister extends AbstractEntityPersister {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean[] getTableHasColumns() {
|
|
||||||
return ArrayHelper.TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int[] getPropertyTableNumbers() {
|
protected int[] getPropertyTableNumbers() {
|
||||||
return new int[getPropertySpan()];
|
return new int[getPropertySpan()];
|
||||||
|
|
|
@ -27,10 +27,8 @@ import org.hibernate.metamodel.mapping.CollectionPart;
|
||||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||||
import org.hibernate.persister.collection.CollectionPersister;
|
import org.hibernate.persister.collection.CollectionPersister;
|
||||||
import org.hibernate.persister.collection.QueryableCollection;
|
import org.hibernate.persister.collection.QueryableCollection;
|
||||||
import org.hibernate.persister.collection.SQLLoadableCollection;
|
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
import org.hibernate.persister.entity.Loadable;
|
import org.hibernate.persister.entity.Loadable;
|
||||||
import org.hibernate.persister.entity.SQLLoadable;
|
|
||||||
import org.hibernate.query.NativeQuery;
|
import org.hibernate.query.NativeQuery;
|
||||||
import org.hibernate.query.results.FetchBuilder;
|
import org.hibernate.query.results.FetchBuilder;
|
||||||
import org.hibernate.query.results.ResultSetMapping;
|
import org.hibernate.query.results.ResultSetMapping;
|
||||||
|
@ -236,7 +234,7 @@ public class ResultSetMappingProcessor implements SQLQueryParser.ParserContext {
|
||||||
null,
|
null,
|
||||||
determineNavigablePath( fetchBuilder )
|
determineNavigablePath( fetchBuilder )
|
||||||
);
|
);
|
||||||
final SQLLoadable loadable = (SQLLoadable) alias2Persister.get( fetchBuilder.getOwnerAlias() );
|
final Loadable loadable = (Loadable) alias2Persister.get( fetchBuilder.getOwnerAlias() );
|
||||||
final List<String> columnNames;
|
final List<String> columnNames;
|
||||||
final String[] columnAliases = loadable.getSubclassPropertyColumnAliases(
|
final String[] columnAliases = loadable.getSubclassPropertyColumnAliases(
|
||||||
fetchBuilder.getFetchableName(),
|
fetchBuilder.getFetchableName(),
|
||||||
|
@ -308,7 +306,7 @@ public class ResultSetMappingProcessor implements SQLQueryParser.ParserContext {
|
||||||
String suffix,
|
String suffix,
|
||||||
LockMode lockMode,
|
LockMode lockMode,
|
||||||
NavigablePath navigablePath) {
|
NavigablePath navigablePath) {
|
||||||
final SQLLoadable loadable = (SQLLoadable) entityMapping.getEntityPersister();
|
final Loadable loadable = (Loadable) entityMapping.getEntityPersister();
|
||||||
final DynamicResultBuilderEntityStandard resultBuilderEntity = new DynamicResultBuilderEntityStandard(
|
final DynamicResultBuilderEntityStandard resultBuilderEntity = new DynamicResultBuilderEntityStandard(
|
||||||
entityMapping,
|
entityMapping,
|
||||||
tableAlias,
|
tableAlias,
|
||||||
|
@ -347,7 +345,7 @@ public class ResultSetMappingProcessor implements SQLQueryParser.ParserContext {
|
||||||
|
|
||||||
private void addFetchBuilder(
|
private void addFetchBuilder(
|
||||||
String suffix,
|
String suffix,
|
||||||
SQLLoadable loadable,
|
Loadable loadable,
|
||||||
DynamicFetchBuilderContainer resultBuilderEntity,
|
DynamicFetchBuilderContainer resultBuilderEntity,
|
||||||
String tableAlias,
|
String tableAlias,
|
||||||
String[] identifierAliases,
|
String[] identifierAliases,
|
||||||
|
@ -441,14 +439,14 @@ public class ResultSetMappingProcessor implements SQLQueryParser.ParserContext {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private SQLLoadable getSQLLoadable(String entityName) throws MappingException {
|
private Loadable getSQLLoadable(String entityName) throws MappingException {
|
||||||
final EntityPersister entityDescriptor = factory.getRuntimeMetamodels()
|
final EntityPersister entityDescriptor = factory.getRuntimeMetamodels()
|
||||||
.getMappingMetamodel()
|
.getMappingMetamodel()
|
||||||
.getEntityDescriptor( entityName );
|
.getEntityDescriptor( entityName );
|
||||||
if ( !(entityDescriptor instanceof SQLLoadable) ) {
|
if ( !(entityDescriptor instanceof Loadable) ) {
|
||||||
throw new MappingException( "class persister is not SQLLoadable: " + entityName );
|
throw new MappingException( "class persister is not Loadable: " + entityName );
|
||||||
}
|
}
|
||||||
return (SQLLoadable) entityDescriptor;
|
return (Loadable) entityDescriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String generateEntitySuffix() {
|
private String generateEntitySuffix() {
|
||||||
|
@ -501,12 +499,12 @@ public class ResultSetMappingProcessor implements SQLQueryParser.ParserContext {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SQLLoadable persister = (SQLLoadable) rootReturn.getEntityMapping().getEntityPersister();
|
Loadable persister = (Loadable) rootReturn.getEntityMapping().getEntityPersister();
|
||||||
Map<String, String[]> propertyResultsMap = Collections.emptyMap();//rootReturn.getPropertyResultsMap()
|
Map<String, String[]> propertyResultsMap = Collections.emptyMap();//rootReturn.getPropertyResultsMap()
|
||||||
addPersister( rootReturn.getTableAlias(), propertyResultsMap, persister );
|
addPersister( rootReturn.getTableAlias(), propertyResultsMap, persister );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addPersister(String alias, Map<String, String[]> propertyResult, SQLLoadable persister) {
|
private void addPersister(String alias, Map<String, String[]> propertyResult, Loadable persister) {
|
||||||
alias2Persister.put( alias, persister );
|
alias2Persister.put( alias, persister );
|
||||||
String suffix = generateEntitySuffix();
|
String suffix = generateEntitySuffix();
|
||||||
LOG.tracev( "Mapping alias [{0}] to entity-suffix [{1}]", alias, suffix );
|
LOG.tracev( "Mapping alias [{0}] to entity-suffix [{1}]", alias, suffix );
|
||||||
|
@ -516,9 +514,9 @@ public class ResultSetMappingProcessor implements SQLQueryParser.ParserContext {
|
||||||
|
|
||||||
private void addCollection(String role, String alias, Map<String, String[]> propertyResults) {
|
private void addCollection(String role, String alias, Map<String, String[]> propertyResults) {
|
||||||
|
|
||||||
final SQLLoadableCollection collectionDescriptor = (SQLLoadableCollection) factory.getRuntimeMetamodels()
|
final QueryableCollection collectionDescriptor = (QueryableCollection)
|
||||||
.getMappingMetamodel()
|
factory.getRuntimeMetamodels().getMappingMetamodel()
|
||||||
.getCollectionDescriptor( role );
|
.getCollectionDescriptor( role );
|
||||||
|
|
||||||
alias2CollectionPersister.put( alias, collectionDescriptor );
|
alias2CollectionPersister.put( alias, collectionDescriptor );
|
||||||
String suffix = generateCollectionSuffix();
|
String suffix = generateCollectionSuffix();
|
||||||
|
@ -527,7 +525,7 @@ public class ResultSetMappingProcessor implements SQLQueryParser.ParserContext {
|
||||||
collectionPropertyResultMaps.put( alias, propertyResults );
|
collectionPropertyResultMaps.put( alias, propertyResults );
|
||||||
|
|
||||||
if ( collectionDescriptor.isOneToMany() || collectionDescriptor.isManyToMany() ) {
|
if ( collectionDescriptor.isOneToMany() || collectionDescriptor.isManyToMany() ) {
|
||||||
SQLLoadable persister = ( SQLLoadable ) collectionDescriptor.getElementPersister();
|
Loadable persister = (Loadable) collectionDescriptor.getElementPersister();
|
||||||
addPersister( alias, filter( propertyResults ), persister );
|
addPersister( alias, filter( propertyResults ), persister );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -565,7 +563,7 @@ public class ResultSetMappingProcessor implements SQLQueryParser.ParserContext {
|
||||||
processReturn( alias2Return.get( ownerAlias ) );
|
processReturn( alias2Return.get( ownerAlias ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
SQLLoadable ownerPersister = ( SQLLoadable ) alias2Persister.get( ownerAlias );
|
Loadable ownerPersister = (Loadable) alias2Persister.get( ownerAlias );
|
||||||
Type returnType = ownerPersister.getPropertyType( fetchReturn.getFetchableName() );
|
Type returnType = ownerPersister.getPropertyType( fetchReturn.getFetchableName() );
|
||||||
|
|
||||||
if ( returnType.isCollectionType() ) {
|
if ( returnType.isCollectionType() ) {
|
||||||
|
@ -577,7 +575,7 @@ public class ResultSetMappingProcessor implements SQLQueryParser.ParserContext {
|
||||||
else if ( returnType.isEntityType() ) {
|
else if ( returnType.isEntityType() ) {
|
||||||
EntityType eType = ( EntityType ) returnType;
|
EntityType eType = ( EntityType ) returnType;
|
||||||
String returnEntityName = eType.getAssociatedEntityName();
|
String returnEntityName = eType.getAssociatedEntityName();
|
||||||
SQLLoadable persister = getSQLLoadable( returnEntityName );
|
Loadable persister = getSQLLoadable( returnEntityName );
|
||||||
Map<String, String[]> propertyResultsMap = Collections.emptyMap();//fetchReturn.getPropertyResultsMap()
|
Map<String, String[]> propertyResultsMap = Collections.emptyMap();//fetchReturn.getPropertyResultsMap()
|
||||||
addPersister( alias, propertyResultsMap, persister );
|
addPersister( alias, propertyResultsMap, persister );
|
||||||
}
|
}
|
||||||
|
@ -594,13 +592,13 @@ public class ResultSetMappingProcessor implements SQLQueryParser.ParserContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SQLLoadable getEntityPersister(String alias) {
|
public Loadable getEntityPersister(String alias) {
|
||||||
return (SQLLoadable) alias2Persister.get( alias );
|
return (Loadable) alias2Persister.get( alias );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SQLLoadableCollection getCollectionPersister(String alias) {
|
public QueryableCollection getCollectionPersister(String alias) {
|
||||||
return (SQLLoadableCollection) alias2CollectionPersister.get( alias );
|
return (QueryableCollection) alias2CollectionPersister.get( alias );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -13,8 +13,8 @@ import org.hibernate.boot.model.naming.Identifier;
|
||||||
import org.hibernate.boot.model.relational.SqlStringGenerationContext;
|
import org.hibernate.boot.model.relational.SqlStringGenerationContext;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.persister.collection.SQLLoadableCollection;
|
import org.hibernate.persister.collection.QueryableCollection;
|
||||||
import org.hibernate.persister.entity.SQLLoadable;
|
import org.hibernate.persister.entity.Loadable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Substitutes escape sequences of form {@code {alias}},
|
* Substitutes escape sequences of form {@code {alias}},
|
||||||
|
@ -36,10 +36,10 @@ public class SQLQueryParser {
|
||||||
|
|
||||||
public interface ParserContext {
|
public interface ParserContext {
|
||||||
boolean isEntityAlias(String aliasName);
|
boolean isEntityAlias(String aliasName);
|
||||||
SQLLoadable getEntityPersister(String alias);
|
Loadable getEntityPersister(String alias);
|
||||||
String getEntitySuffix(String alias);
|
String getEntitySuffix(String alias);
|
||||||
boolean isCollectionAlias(String aliasName);
|
boolean isCollectionAlias(String aliasName);
|
||||||
SQLLoadableCollection getCollectionPersister(String alias);
|
QueryableCollection getCollectionPersister(String alias);
|
||||||
String getCollectionSuffix(String alias);
|
String getCollectionSuffix(String alias);
|
||||||
Map<String, String[]> getPropertyResultsMap(String alias);
|
Map<String, String[]> getPropertyResultsMap(String alias);
|
||||||
}
|
}
|
||||||
|
@ -207,7 +207,7 @@ public class SQLQueryParser {
|
||||||
String aliasName,
|
String aliasName,
|
||||||
String propertyName) {
|
String propertyName) {
|
||||||
final Map<String, String[]> fieldResults = context.getPropertyResultsMap( aliasName );
|
final Map<String, String[]> fieldResults = context.getPropertyResultsMap( aliasName );
|
||||||
final SQLLoadableCollection collectionPersister = context.getCollectionPersister( aliasName );
|
final QueryableCollection collectionPersister = context.getCollectionPersister( aliasName );
|
||||||
final String collectionSuffix = context.getCollectionSuffix( aliasName );
|
final String collectionSuffix = context.getCollectionSuffix( aliasName );
|
||||||
switch ( propertyName ) {
|
switch ( propertyName ) {
|
||||||
case "*":
|
case "*":
|
||||||
|
@ -234,7 +234,7 @@ public class SQLQueryParser {
|
||||||
|
|
||||||
private String resolveProperties(String aliasName, String propertyName) {
|
private String resolveProperties(String aliasName, String propertyName) {
|
||||||
final Map<String, String[]> fieldResults = context.getPropertyResultsMap( aliasName );
|
final Map<String, String[]> fieldResults = context.getPropertyResultsMap( aliasName );
|
||||||
final SQLLoadable persister = context.getEntityPersister( aliasName );
|
final Loadable persister = context.getEntityPersister( aliasName );
|
||||||
final String suffix = context.getEntitySuffix( aliasName );
|
final String suffix = context.getEntitySuffix( aliasName );
|
||||||
if ( "*".equals( propertyName ) ) {
|
if ( "*".equals( propertyName ) ) {
|
||||||
if ( !fieldResults.isEmpty() ) {
|
if ( !fieldResults.isEmpty() ) {
|
||||||
|
|
Loading…
Reference in New Issue