initial work for table per class inheritance
This commit is contained in:
parent
27968b8027
commit
520c8f2004
|
@ -6070,7 +6070,7 @@ public abstract class AbstractEntityPersister
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( superMappingType != null ) {
|
if ( superMappingType != null && shouldProcessSuperMapping() ) {
|
||||||
( (InFlightEntityMappingType) superMappingType ).prepareMappingModel( creationProcess );
|
( (InFlightEntityMappingType) superMappingType ).prepareMappingModel( creationProcess );
|
||||||
|
|
||||||
this.identifierMapping = superMappingType.getIdentifierMapping();
|
this.identifierMapping = superMappingType.getIdentifierMapping();
|
||||||
|
@ -6097,7 +6097,7 @@ public abstract class AbstractEntityPersister
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( getDiscriminatorType() == null ) {
|
if ( getDiscriminatorType() == null && shouldProcessSuperMapping() ) {
|
||||||
discriminatorMapping = null;
|
discriminatorMapping = null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -6127,7 +6127,7 @@ public abstract class AbstractEntityPersister
|
||||||
final NonIdentifierAttribute runtimeAttrDefinition = currentEntityMetamodel.getProperties()[i];
|
final NonIdentifierAttribute runtimeAttrDefinition = currentEntityMetamodel.getProperties()[i];
|
||||||
final Property bootProperty = bootEntityDescriptor.getProperty( runtimeAttrDefinition.getName() );
|
final Property bootProperty = bootEntityDescriptor.getProperty( runtimeAttrDefinition.getName() );
|
||||||
|
|
||||||
if ( superMappingType != null && superMappingType.findAttributeMapping( bootProperty.getName() ) != null ) {
|
if ( superMappingType != null && superMappingType.findAttributeMapping( bootProperty.getName() ) != null && shouldProcessSuperMapping() ) {
|
||||||
// its defined on the super-type, skip it here
|
// its defined on the super-type, skip it here
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -6156,6 +6156,10 @@ public abstract class AbstractEntityPersister
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean shouldProcessSuperMapping(){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void linkWithSuperType(MappingModelCreationProcess creationProcess) {
|
public void linkWithSuperType(MappingModelCreationProcess creationProcess) {
|
||||||
if ( getMappedSuperclass() == null ) {
|
if ( getMappedSuperclass() == null ) {
|
||||||
|
|
|
@ -14,6 +14,8 @@ import java.util.Iterator;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import org.hibernate.AssertionFailure;
|
import org.hibernate.AssertionFailure;
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
|
@ -21,6 +23,7 @@ import org.hibernate.LockMode;
|
||||||
import org.hibernate.MappingException;
|
import org.hibernate.MappingException;
|
||||||
import org.hibernate.NotYetImplementedFor6Exception;
|
import org.hibernate.NotYetImplementedFor6Exception;
|
||||||
import org.hibernate.boot.model.relational.Database;
|
import org.hibernate.boot.model.relational.Database;
|
||||||
|
import org.hibernate.bytecode.spi.ReflectionOptimizer;
|
||||||
import org.hibernate.cache.spi.access.EntityDataAccess;
|
import org.hibernate.cache.spi.access.EntityDataAccess;
|
||||||
import org.hibernate.cache.spi.access.NaturalIdDataAccess;
|
import org.hibernate.cache.spi.access.NaturalIdDataAccess;
|
||||||
import org.hibernate.cfg.Settings;
|
import org.hibernate.cfg.Settings;
|
||||||
|
@ -37,11 +40,27 @@ import org.hibernate.internal.util.collections.JoinedIterator;
|
||||||
import org.hibernate.internal.util.collections.SingletonIterator;
|
import org.hibernate.internal.util.collections.SingletonIterator;
|
||||||
import org.hibernate.mapping.Column;
|
import org.hibernate.mapping.Column;
|
||||||
import org.hibernate.mapping.PersistentClass;
|
import org.hibernate.mapping.PersistentClass;
|
||||||
|
import org.hibernate.mapping.Property;
|
||||||
import org.hibernate.mapping.Subclass;
|
import org.hibernate.mapping.Subclass;
|
||||||
import org.hibernate.mapping.Table;
|
import org.hibernate.mapping.Table;
|
||||||
|
import org.hibernate.metamodel.mapping.EntityIdentifierMapping;
|
||||||
|
import org.hibernate.metamodel.mapping.internal.EntityDiscriminatorMappingImpl;
|
||||||
|
import org.hibernate.metamodel.mapping.internal.InFlightEntityMappingType;
|
||||||
|
import org.hibernate.metamodel.mapping.internal.MappingModelCreationProcess;
|
||||||
|
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
|
||||||
import org.hibernate.persister.spi.PersisterCreationContext;
|
import org.hibernate.persister.spi.PersisterCreationContext;
|
||||||
|
import org.hibernate.query.NavigablePath;
|
||||||
|
import org.hibernate.query.sqm.sql.SqlExpressionResolver;
|
||||||
import org.hibernate.sql.SelectFragment;
|
import org.hibernate.sql.SelectFragment;
|
||||||
import org.hibernate.sql.SimpleSelect;
|
import org.hibernate.sql.SimpleSelect;
|
||||||
|
import org.hibernate.sql.ast.JoinType;
|
||||||
|
import org.hibernate.sql.ast.spi.SqlAliasBaseGenerator;
|
||||||
|
import org.hibernate.sql.ast.spi.SqlAstCreationContext;
|
||||||
|
import org.hibernate.sql.ast.tree.from.TableGroup;
|
||||||
|
import org.hibernate.sql.ast.tree.predicate.Predicate;
|
||||||
|
import org.hibernate.tuple.NonIdentifierAttribute;
|
||||||
|
import org.hibernate.tuple.entity.EntityMetamodel;
|
||||||
|
import org.hibernate.type.BasicType;
|
||||||
import org.hibernate.type.StandardBasicTypes;
|
import org.hibernate.type.StandardBasicTypes;
|
||||||
import org.hibernate.type.Type;
|
import org.hibernate.type.Type;
|
||||||
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||||
|
@ -220,6 +239,11 @@ public class UnionSubclassEntityPersister extends AbstractEntityPersister {
|
||||||
return subclassSpaces;
|
return subclassSpaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRootTableName() {
|
||||||
|
return tableName;
|
||||||
|
}
|
||||||
|
|
||||||
public String getTableName() {
|
public String getTableName() {
|
||||||
return subquery;
|
return subquery;
|
||||||
}
|
}
|
||||||
|
@ -285,6 +309,11 @@ public class UnionSubclassEntityPersister extends AbstractEntityPersister {
|
||||||
return select.addCondition( getIdentifierColumnNames(), "=?" ).toStatementString();
|
return select.addCondition( getIdentifierColumnNames(), "=?" ).toStatementString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean shouldProcessSuperMapping() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
protected String getDiscriminatorFormula() {
|
protected String getDiscriminatorFormula() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue