clean up some warnings
use Metadata instead of deprecated Mapping (I'm not sure that's really an improvement)
This commit is contained in:
parent
d2b740ce5b
commit
dcd7ebbb56
|
@ -201,7 +201,9 @@ public interface ClassMetadata {
|
|||
* @deprecated Use {@link #getIdentifier(Object,SharedSessionContractImplementor)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
Object getIdentifier(Object object) throws HibernateException;
|
||||
default Object getIdentifier(Object object) throws HibernateException {
|
||||
return getIdentifier( object, null );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the identifier of an instance (throw an exception if no identifier property)
|
||||
|
|
|
@ -613,8 +613,8 @@ public abstract class AbstractCollectionPersister
|
|||
elementColumnReaderTemplates,
|
||||
elementFormulaTemplates,
|
||||
(CompositeType) elementType,
|
||||
factory
|
||||
);
|
||||
creationContext.getMetadata()
|
||||
);
|
||||
}
|
||||
else if ( !elementType.isEntityType() ) {
|
||||
elementPropertyMapping = new ElementPropertyMapping(
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
package org.hibernate.persister.collection;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.engine.spi.Mapping;
|
||||
import org.hibernate.boot.Metadata;
|
||||
import org.hibernate.persister.entity.AbstractPropertyMapping;
|
||||
import org.hibernate.type.CompositeType;
|
||||
import org.hibernate.type.Type;
|
||||
|
@ -24,13 +24,13 @@ public class CompositeElementPropertyMapping extends AbstractPropertyMapping {
|
|||
String[] elementColumnReaderTemplates,
|
||||
String[] elementFormulaTemplates,
|
||||
CompositeType compositeType,
|
||||
Mapping factory)
|
||||
Metadata factory)
|
||||
throws MappingException {
|
||||
|
||||
this.compositeType = compositeType;
|
||||
|
||||
initComponentPropertyPaths(null, compositeType, elementColumns, elementColumnReaders,
|
||||
elementColumnReaderTemplates, elementFormulaTemplates, factory);
|
||||
elementColumnReaderTemplates, elementFormulaTemplates, factory );
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ import org.hibernate.QueryException;
|
|||
import org.hibernate.Session;
|
||||
import org.hibernate.StaleObjectStateException;
|
||||
import org.hibernate.StaleStateException;
|
||||
import org.hibernate.boot.Metadata;
|
||||
import org.hibernate.boot.spi.SessionFactoryOptions;
|
||||
import org.hibernate.bytecode.enhance.spi.LazyPropertyInitializer;
|
||||
import org.hibernate.bytecode.enhance.spi.interceptor.BytecodeLazyAttributeInterceptor;
|
||||
|
@ -85,7 +86,6 @@ import org.hibernate.engine.spi.EntityEntryFactory;
|
|||
import org.hibernate.engine.spi.EntityKey;
|
||||
import org.hibernate.engine.spi.ExecuteUpdateResultCheckStyle;
|
||||
import org.hibernate.engine.spi.LoadQueryInfluencers;
|
||||
import org.hibernate.engine.spi.Mapping;
|
||||
import org.hibernate.engine.spi.NaturalIdResolutions;
|
||||
import org.hibernate.engine.spi.PersistenceContext;
|
||||
import org.hibernate.engine.spi.PersistentAttributeInterceptable;
|
||||
|
@ -2694,7 +2694,7 @@ public abstract class AbstractEntityPersister
|
|||
return sqlWhereStringTemplate != null;
|
||||
}
|
||||
|
||||
private void initOrdinaryPropertyPaths(Mapping mapping) throws MappingException {
|
||||
private void initOrdinaryPropertyPaths(Metadata mapping) throws MappingException {
|
||||
for ( int i = 0; i < getSubclassPropertyNameClosure().length; i++ ) {
|
||||
propertyMapping.initPropertyPaths(
|
||||
getSubclassPropertyNameClosure()[i],
|
||||
|
@ -2708,7 +2708,7 @@ public abstract class AbstractEntityPersister
|
|||
}
|
||||
}
|
||||
|
||||
private void initIdentifierPropertyPaths(Mapping mapping) throws MappingException {
|
||||
private void initIdentifierPropertyPaths(Metadata mapping) throws MappingException {
|
||||
String idProp = getIdentifierPropertyName();
|
||||
if ( idProp != null ) {
|
||||
propertyMapping.initPropertyPaths(
|
||||
|
@ -2730,7 +2730,7 @@ public abstract class AbstractEntityPersister
|
|||
}
|
||||
}
|
||||
|
||||
private void initDiscriminatorPropertyPath() {
|
||||
private void initDiscriminatorPropertyPath(Metadata mapping) {
|
||||
propertyMapping.initPropertyPaths(
|
||||
ENTITY_CLASS,
|
||||
getDiscriminatorType(),
|
||||
|
@ -2738,16 +2738,16 @@ public abstract class AbstractEntityPersister
|
|||
new String[] {getDiscriminatorColumnReaders()},
|
||||
new String[] {getDiscriminatorColumnReaderTemplate()},
|
||||
new String[] {getDiscriminatorFormulaTemplate()},
|
||||
getFactory()
|
||||
mapping
|
||||
);
|
||||
}
|
||||
|
||||
protected void initPropertyPaths(Mapping mapping) throws MappingException {
|
||||
protected void initPropertyPaths(Metadata mapping) throws MappingException {
|
||||
initOrdinaryPropertyPaths( mapping );
|
||||
initOrdinaryPropertyPaths( mapping ); //do two passes, for collection property-ref!
|
||||
initIdentifierPropertyPaths( mapping );
|
||||
if ( entityMetamodel.isPolymorphic() ) {
|
||||
initDiscriminatorPropertyPath();
|
||||
initDiscriminatorPropertyPath( mapping );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4054,7 +4054,7 @@ public abstract class AbstractEntityPersister
|
|||
*
|
||||
* @throws MappingException Indicates a problem accessing the Mapping
|
||||
*/
|
||||
protected void postConstruct(Mapping mapping) throws MappingException {
|
||||
protected void postConstruct(Metadata mapping) throws MappingException {
|
||||
initPropertyPaths( mapping );
|
||||
|
||||
//doLateInit();
|
||||
|
@ -5054,11 +5054,6 @@ public abstract class AbstractEntityPersister
|
|||
return getPropertyValue( baseValue, baseValueType, propertyName, nextDotIndex );
|
||||
}
|
||||
|
||||
@Override @Deprecated
|
||||
public Object getIdentifier(Object object) {
|
||||
return getIdentifier( object, null );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getIdentifier(Object entity, SharedSessionContractImplementor session) {
|
||||
return identifierMapping.getIdentifier( entity );
|
||||
|
@ -5160,8 +5155,12 @@ public abstract class AbstractEntityPersister
|
|||
}
|
||||
}
|
||||
|
||||
@Override @Deprecated
|
||||
@Override @Deprecated(since = "6.0")
|
||||
public boolean isMultiTable() {
|
||||
return hasMultipleTables();
|
||||
}
|
||||
|
||||
protected boolean hasMultipleTables() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -5585,7 +5584,7 @@ public abstract class AbstractEntityPersister
|
|||
}
|
||||
);
|
||||
|
||||
boolean needsMultiTableInsert = isMultiTable();
|
||||
boolean needsMultiTableInsert = hasMultipleTables();
|
||||
if ( needsMultiTableInsert ) {
|
||||
creationProcess.registerInitializationCallback(
|
||||
"Entity(" + getEntityName() + ") `sqmMultiTableMutationStrategy` interpretation",
|
||||
|
@ -5741,7 +5740,7 @@ public abstract class AbstractEntityPersister
|
|||
protected static SqmMultiTableMutationStrategy interpretSqmMultiTableStrategy(
|
||||
AbstractEntityPersister entityMappingDescriptor,
|
||||
MappingModelCreationProcess creationProcess) {
|
||||
assert entityMappingDescriptor.isMultiTable();
|
||||
assert entityMappingDescriptor.hasMultipleTables();
|
||||
|
||||
EntityMappingType superMappingType = entityMappingDescriptor.getSuperMappingType();
|
||||
if ( superMappingType != null ) {
|
||||
|
|
|
@ -13,6 +13,7 @@ import java.util.Set;
|
|||
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.QueryException;
|
||||
import org.hibernate.boot.Metadata;
|
||||
import org.hibernate.boot.spi.MetadataImplementor;
|
||||
import org.hibernate.engine.spi.Mapping;
|
||||
import org.hibernate.internal.CoreLogging;
|
||||
|
@ -134,7 +135,7 @@ public abstract class AbstractPropertyMapping implements PropertyMapping {
|
|||
String[] columnReaders,
|
||||
String[] columnReaderTemplates,
|
||||
String[] formulaTemplates,
|
||||
Mapping factory) {
|
||||
Metadata factory) {
|
||||
Type existingType = typesByPropertyPath.get( path );
|
||||
if ( existingType != null || ( duplicateIncompatiblePaths != null && duplicateIncompatiblePaths.contains( path ) ) ) {
|
||||
// If types match or the new type is not an association type, there is nothing for us to do
|
||||
|
@ -265,7 +266,7 @@ public abstract class AbstractPropertyMapping implements PropertyMapping {
|
|||
String[] columnReaders,
|
||||
String[] columnReaderTemplates,
|
||||
final String[] formulaTemplates,
|
||||
final Mapping factory) throws MappingException {
|
||||
final Metadata factory) throws MappingException {
|
||||
assert columns != null : "Incoming columns should not be null : " + path;
|
||||
assert type != null : "Incoming type should not be null : " + path;
|
||||
|
||||
|
@ -344,7 +345,7 @@ public abstract class AbstractPropertyMapping implements PropertyMapping {
|
|||
final String[] columns,
|
||||
final String[] columnReaders,
|
||||
final String[] columnReaderTemplates,
|
||||
final Mapping factory) throws MappingException {
|
||||
final Metadata factory) throws MappingException {
|
||||
initIdentifierPropertyPaths(path, etype, columns, columnReaders, columnReaderTemplates, null, factory);
|
||||
}
|
||||
|
||||
|
@ -355,7 +356,7 @@ public abstract class AbstractPropertyMapping implements PropertyMapping {
|
|||
final String[] columnReaders,
|
||||
final String[] columnReaderTemplates,
|
||||
final String[] formulaTemplates,
|
||||
final Mapping factory) throws MappingException {
|
||||
final Metadata factory) throws MappingException {
|
||||
|
||||
Type idtype = etype.getIdentifierOrUniqueKeyType( factory );
|
||||
String idPropName = etype.getIdentifierOrUniqueKeyPropertyName( factory );
|
||||
|
@ -398,7 +399,7 @@ public abstract class AbstractPropertyMapping implements PropertyMapping {
|
|||
final String[] columnReaders,
|
||||
final String[] columnReaderTemplates,
|
||||
final String[] formulaTemplates,
|
||||
final Mapping factory) throws MappingException {
|
||||
final Metadata factory) throws MappingException {
|
||||
|
||||
Type[] types = type.getSubtypes();
|
||||
String[] properties = type.getPropertyNames();
|
||||
|
|
|
@ -510,14 +510,14 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
propTableNumbers.add( tableNumber );
|
||||
|
||||
for ( Selectable selectable : property.getSelectables() ) {
|
||||
if ( selectable.isFormula() ) {
|
||||
// formulaTableNumbers.add( tableNumber );
|
||||
}
|
||||
else {
|
||||
if ( !selectable.isFormula() ) {
|
||||
columnTableNumbers.add( tableNumber );
|
||||
Column column = (Column) selectable;
|
||||
columns.add( column.getQuotedName( dialect ) );
|
||||
}
|
||||
// else {
|
||||
// formulaTableNumbers.add( tableNumber );
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1009,8 +1009,8 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
return tableSpan;
|
||||
}
|
||||
|
||||
@Override @Deprecated
|
||||
public boolean isMultiTable() {
|
||||
@Override
|
||||
protected boolean hasMultipleTables() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,9 @@ public interface Queryable extends Loadable, PropertyMapping, Joinable {
|
|||
* @deprecated Use {@link EntityPersister#getSqmMultiTableMutationStrategy} instead
|
||||
*/
|
||||
@Deprecated(since = "6.0")
|
||||
boolean isMultiTable();
|
||||
default boolean isMultiTable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the names of all tables used in the hierarchy (up and down) ordered such
|
||||
|
|
|
@ -649,6 +649,7 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
|
|||
private String[] decodeTreatAsRequests(Set<String> treatAsDeclarations) {
|
||||
final List<String> values = new ArrayList<>();
|
||||
for ( String subclass : treatAsDeclarations ) {
|
||||
//TODO: move getDiscriminatorSQLValue() to Loadable to get rid of Queryable
|
||||
final Queryable queryable = (Queryable) getFactory()
|
||||
.getRuntimeMetamodels()
|
||||
.getMappingMetamodel()
|
||||
|
@ -707,7 +708,7 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
|
|||
// first access; build it
|
||||
final List<Object> values = new ArrayList<>();
|
||||
for ( String subclass : getSubclassClosure() ) {
|
||||
final Queryable queryable = (Queryable) getFactory().getRuntimeMetamodels()
|
||||
final Loadable queryable = (Loadable) getFactory().getRuntimeMetamodels()
|
||||
.getMappingMetamodel()
|
||||
.getEntityDescriptor( subclass );
|
||||
if ( !queryable.isAbstract() ) {
|
||||
|
@ -795,8 +796,8 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
|
|||
return index == null ? null : qualifiedTableNames[propertyTableNumbers[index]];
|
||||
}
|
||||
|
||||
@Override @Deprecated
|
||||
public boolean isMultiTable() {
|
||||
@Override
|
||||
protected boolean hasMultipleTables() {
|
||||
return getTableSpan() > 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,12 +23,12 @@ import java.util.function.Supplier;
|
|||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.boot.Metadata;
|
||||
import org.hibernate.boot.model.relational.SqlStringGenerationContext;
|
||||
import org.hibernate.cache.spi.access.EntityDataAccess;
|
||||
import org.hibernate.cache.spi.access.NaturalIdDataAccess;
|
||||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.engine.spi.ExecuteUpdateResultCheckStyle;
|
||||
import org.hibernate.engine.spi.Mapping;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.id.IdentityGenerator;
|
||||
import org.hibernate.internal.FilterAliasGenerator;
|
||||
|
@ -212,7 +212,7 @@ public class UnionSubclassEntityPersister extends AbstractEntityPersister {
|
|||
}
|
||||
subclassTableExpressions = ArrayHelper.toStringArray( tableExpressions );
|
||||
|
||||
if ( isMultiTable() ) {
|
||||
if ( hasMultipleTables() ) {
|
||||
int idColumnSpan = getIdentifierColumnSpan();
|
||||
ArrayList<String> tableNames = new ArrayList<>();
|
||||
ArrayList<String[]> keyColumns = new ArrayList<>();
|
||||
|
@ -374,8 +374,8 @@ public class UnionSubclassEntityPersister extends AbstractEntityPersister {
|
|||
return 0;
|
||||
}
|
||||
|
||||
@Override @Deprecated
|
||||
public boolean isMultiTable() {
|
||||
@Override
|
||||
protected boolean hasMultipleTables() {
|
||||
// This could also just be true all the time...
|
||||
return isAbstract() || hasSubclasses();
|
||||
}
|
||||
|
@ -429,7 +429,7 @@ public class UnionSubclassEntityPersister extends AbstractEntityPersister {
|
|||
return new int[getPropertySpan()];
|
||||
}
|
||||
|
||||
protected String generateSubquery(PersistentClass model, Mapping mapping) {
|
||||
protected String generateSubquery(PersistentClass model, Metadata mapping) {
|
||||
|
||||
Dialect dialect = getFactory().getJdbcServices().getDialect();
|
||||
SqlStringGenerationContext sqlStringGenerationContext = getFactory().getSqlStringGenerationContext();
|
||||
|
@ -460,7 +460,7 @@ public class UnionSubclassEntityPersister extends AbstractEntityPersister {
|
|||
buf.append( "select " );
|
||||
for ( Column col : columns ) {
|
||||
if ( !table.containsColumn(col) ) {
|
||||
int sqlType = col.getSqlTypeCode(mapping);
|
||||
int sqlType = col.getSqlTypeCode( mapping );
|
||||
buf.append( dialect.getSelectClauseNullString(sqlType) )
|
||||
.append(" as ");
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ package org.hibernate.tool.schema.internal;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.hibernate.MappingException;
|
||||
|
|
Loading…
Reference in New Issue