add missing @Override annotations

This commit is contained in:
Gavin King 2022-01-29 13:14:22 +01:00
parent 38f4c70e7b
commit 929cbd1139
4 changed files with 208 additions and 26 deletions

View File

@ -430,6 +430,7 @@ public abstract class AbstractEntityPersister
protected abstract int[] getSubclassFormulaTableNumberClosure();
@Override
public abstract String getSubclassTableName(int j);
protected abstract String[] getSubclassTableNames();
@ -476,6 +477,7 @@ public abstract class AbstractEntityPersister
private static final String DISCRIMINATOR_ALIAS = "clazz_";
@Override
public String getDiscriminatorColumnName() {
return DISCRIMINATOR_ALIAS;
}
@ -517,6 +519,7 @@ public abstract class AbstractEntityPersister
return false;
}
@Override
public boolean isSubclassEntityName(String entityName) {
return entityMetamodel.getSubclassEntityNames().contains( entityName );
}
@ -525,6 +528,7 @@ public abstract class AbstractEntityPersister
return tableHasColumns;
}
@Override
public String[] getRootTableKeyColumnNames() {
return rootTableKeyColumnNames;
}
@ -656,6 +660,7 @@ public abstract class AbstractEntityPersister
}
}
@Override
public boolean hasRowId() {
return rowIdName != null;
}
@ -1178,6 +1183,7 @@ public abstract class AbstractEntityPersister
: new StandardCacheEntryHelper( this );
}
@Override
public boolean canUseReferenceCacheEntries() {
return useReferenceCacheEntries;
}
@ -1525,6 +1531,7 @@ public abstract class AbstractEntityPersister
);
}
@Override
public Object initializeLazyProperty(String fieldName, Object entity, SharedSessionContractImplementor session) {
final PersistenceContext persistenceContext = session.getPersistenceContextInternal();
final EntityEntry entry = persistenceContext.getEntry( entity );
@ -1789,14 +1796,17 @@ public abstract class AbstractEntityPersister
return navigableRole;
}
@Override
public Serializable[] getQuerySpaces() {
return getPropertySpaces();
}
@Override
public boolean isBatchLoadable() {
return batchSize > 1;
}
@Override
public String[] getIdentifierColumnNames() {
return rootTableKeyColumnNames;
}
@ -1817,6 +1827,7 @@ public abstract class AbstractEntityPersister
return identifierAliases;
}
@Override
public String getVersionColumnName() {
return versionColumnName;
}
@ -1847,14 +1858,17 @@ public abstract class AbstractEntityPersister
* these cases (the item will be readded when it's read again
* fresh from the database).
*/
@Override
public boolean isCacheInvalidationRequired() {
return invalidateCache;
}
@Override
public boolean isLazyPropertiesCacheable() {
return isLazyPropertiesCacheable;
}
@Override
public String selectFragment(String alias, String suffix) {
final QuerySpec rootQuerySpec = new QuerySpec( true );
final String rootTableName = getRootTableName();
@ -2026,6 +2040,7 @@ public abstract class AbstractEntityPersister
return expression;
}
@Override
public String[] getIdentifierAliases(String suffix) {
// NOTE: this assumes something about how propertySelectFragment is implemented by the subclass!
// was toUnquotedAliasStrings( getIdentifierColumnNames() ) before - now tried
@ -2033,11 +2048,13 @@ public abstract class AbstractEntityPersister
return new Alias( suffix ).toAliasStrings( getIdentifierAliases() );
}
@Override
public String[] getPropertyAliases(String suffix, int i) {
// NOTE: this assumes something about how propertySelectFragment is implemented by the subclass!
return new Alias( suffix ).toUnquotedAliasStrings( propertyColumnAliases[i] );
}
@Override
public String getDiscriminatorAlias(String suffix) {
// NOTE: this assumes something about how propertySelectFragment is implemented by the subclass!
// toUnquotedAliasStrings( getDiscriminatorColumnName() ) before - now tried
@ -2047,6 +2064,7 @@ public abstract class AbstractEntityPersister
null;
}
@Override
public Object[] getDatabaseSnapshot(Object id, SharedSessionContractImplementor session) throws HibernateException {
return singleIdEntityLoader.loadDatabaseSnapshot( id, session );
}
@ -2160,6 +2178,7 @@ public abstract class AbstractEntityPersister
/**
* Retrieve the version number
*/
@Override
public Object getCurrentVersion(Object id, SharedSessionContractImplementor session) throws HibernateException {
if ( LOG.isTraceEnabled() ) {
@ -2209,6 +2228,7 @@ public abstract class AbstractEntityPersister
return lockers.computeIfAbsent( lockMode, this::generateLocker );
}
@Override
public void lock(
Object id,
Object version,
@ -2218,6 +2238,7 @@ public abstract class AbstractEntityPersister
getLocker( lockMode ).lock( id, version, object, LockOptions.WAIT_FOREVER, session );
}
@Override
public void lock(
Object id,
Object version,
@ -2227,14 +2248,17 @@ public abstract class AbstractEntityPersister
getLocker( lockOptions.getLockMode() ).lock( id, version, object, lockOptions.getTimeOut(), session );
}
@Override
public String getRootTableName() {
return getSubclassTableName( 0 );
}
@Override
public String getRootTableAlias(String drivingAlias) {
return drivingAlias;
}
@Override
public String[] getRootTableIdentifierColumnNames() {
return getRootTableKeyColumnNames();
}
@ -2292,6 +2316,7 @@ public abstract class AbstractEntityPersister
* SingleTableEntityPersister defines an overloaded form
* which takes the entity name.
*/
@Override
public int getSubclassPropertyTableNumber(String propertyPath) {
String rootPropertyName = StringHelper.root( propertyPath );
Type type = propertyMapping.toType( rootPropertyName );
@ -2321,6 +2346,7 @@ public abstract class AbstractEntityPersister
return index == -1 ? 0 : getSubclassPropertyTableNumber( index );
}
@Override
public Declarer getSubclassPropertyDeclarer(String propertyPath) {
int tableIndex = getSubclassPropertyTableNumber( propertyPath );
if ( tableIndex == 0 ) {
@ -2336,6 +2362,7 @@ public abstract class AbstractEntityPersister
private DiscriminatorMetadata discriminatorMetadata;
@Override
public DiscriminatorMetadata getTypeDiscriminatorMetadata() {
if ( discriminatorMetadata == null ) {
discriminatorMetadata = buildTypeDiscriminatorMetadata();
@ -2358,6 +2385,7 @@ public abstract class AbstractEntityPersister
return buf.append( tableNumber ).append( '_' ).toString();
}
@Override
public String[] toColumns(String name, final int i) {
final String alias = generateTableAlias( name, getSubclassPropertyTableNumber( i ) );
String[] cols = getSubclassPropertyColumnNames( i );
@ -2382,6 +2410,7 @@ public abstract class AbstractEntityPersister
return propertySubclassNames;
}
@Override
public String[] getPropertyColumnNames(int i) {
return propertyColumnNames[i];
}
@ -2398,30 +2427,37 @@ public abstract class AbstractEntityPersister
return hasFormulaProperties;
}
@Override
public FetchMode getFetchMode(int i) {
return subclassPropertyFetchModeClosure[i];
}
@Override
public CascadeStyle getCascadeStyle(int i) {
return subclassPropertyCascadeStyleClosure[i];
}
@Override
public Type getSubclassPropertyType(int i) {
return subclassPropertyTypeClosure[i];
}
@Override
public String getSubclassPropertyName(int i) {
return subclassPropertyNameClosure[i];
}
@Override
public int countSubclassProperties() {
return subclassPropertyTypeClosure.length;
}
@Override
public String[] getSubclassPropertyColumnNames(int i) {
return subclassPropertyColumnNameClosure[i];
}
@Override
public boolean isDefinedOnSubclass(int i) {
return propertyDefinedOnSubclass[i];
}
@ -2552,6 +2588,7 @@ public abstract class AbstractEntityPersister
return subclassFormulaAliasClosure;
}
@Override
public String[] getSubclassPropertyColumnAliases(String propertyName, String suffix) {
String[] rawAliases = subclassPropertyAliases.get( propertyName );
@ -2566,6 +2603,7 @@ public abstract class AbstractEntityPersister
return result;
}
@Override
public String[] getSubclassPropertyColumnNames(String propertyName) {
//TODO: should we allow suffixes on these ?
return subclassPropertyColumnNames.get( propertyName );
@ -2680,6 +2718,7 @@ public abstract class AbstractEntityPersister
return lazyPropertyColumnAliases;
}
@Override
public Object loadByUniqueKey(
String propertyName,
Object uniqueKey,
@ -2718,6 +2757,7 @@ public abstract class AbstractEntityPersister
return loader;
}
@Override
public int getPropertyIndex(String propertyName) {
return entityMetamodel.getPropertyIndex( propertyName );
}
@ -3228,10 +3268,12 @@ public abstract class AbstractEntityPersister
}
Binder binder = new Binder() {
@Override
public void bindValues(PreparedStatement ps) throws SQLException {
dehydrate( null, fields, notNull, propertyColumnInsertable, 0, ps, session, false );
}
@Override
public Object getEntity() {
return object;
}
@ -3240,6 +3282,7 @@ public abstract class AbstractEntityPersister
return identityDelegate.performInsert( sql, session, binder );
}
@Override
public String getIdentitySelectString() {
//TODO: cache this in an instvar
return getFactory().getJdbcServices().getDialect().getIdentityColumnSupport()
@ -3250,6 +3293,7 @@ public abstract class AbstractEntityPersister
);
}
@Override
public String getSelectByUniqueKeyString(String propertyName) {
return new SimpleSelect( getFactory().getJdbcServices().getDialect() )
.setTableName( getTableName( 0 ) )
@ -3708,6 +3752,7 @@ public abstract class AbstractEntityPersister
/**
* Update an object
*/
@Override
public void update(
final Object id,
final Object[] fields,
@ -3826,6 +3871,7 @@ public abstract class AbstractEntityPersister
}
}
@Override
public Object insert(Object[] fields, Object object, SharedSessionContractImplementor session)
throws HibernateException {
// apply any pre-insert in-memory value generation
@ -3851,6 +3897,7 @@ public abstract class AbstractEntityPersister
return id;
}
@Override
public void insert(Object id, Object[] fields, Object object, SharedSessionContractImplementor session) {
// apply any pre-insert in-memory value generation
preInsertInMemoryValueGeneration( fields, object, session );
@ -3886,6 +3933,7 @@ public abstract class AbstractEntityPersister
/**
* Delete an object
*/
@Override
public void delete(Object id, Object version, Object object, SharedSessionContractImplementor session)
throws HibernateException {
final int span = getTableSpan();
@ -4052,6 +4100,7 @@ public abstract class AbstractEntityPersister
return alias;
}
@Override
public String generateFilterConditionAlias(String rootAlias) {
return rootAlias;
}
@ -4162,6 +4211,7 @@ public abstract class AbstractEntityPersister
return new SQLQueryParser( sql, null, getFactory() ).process();
}
@Override
public final void postInstantiate() throws MappingException {
doLateInit();
@ -4184,6 +4234,7 @@ public abstract class AbstractEntityPersister
* Load an instance using either the {@code forUpdateLoader} or the outer joining {@code loader},
* depending upon the value of the {@code lock} parameter
*/
@Override
public Object load(Object id, Object optionalObject, LockMode lockMode, SharedSessionContractImplementor session) {
return load( id, optionalObject, new LockOptions().setLockMode( lockMode ), session );
}
@ -4192,11 +4243,13 @@ public abstract class AbstractEntityPersister
* Load an instance using either the {@code forUpdateLoader} or the outer joining {@code loader},
* depending upon the value of the {@code lock} parameter
*/
@Override
public Object load(Object id, Object optionalObject, LockOptions lockOptions, SharedSessionContractImplementor session)
throws HibernateException {
return doLoad( id, optionalObject, lockOptions, null, session );
}
@Override
public Object load(Object id, Object optionalObject, LockOptions lockOptions, SharedSessionContractImplementor session, Boolean readOnly)
throws HibernateException {
return doLoad( id, optionalObject, lockOptions, readOnly, session );
@ -4289,6 +4342,7 @@ public abstract class AbstractEntityPersister
return multiIdEntityLoader.load( ids, loadOptions, session );
}
@Override
public void registerAffectingFetchProfile(String fetchProfileName) {
if ( affectingFetchProfileNames == null ) {
this.affectingFetchProfileNames = new HashSet<>();
@ -4353,6 +4407,7 @@ public abstract class AbstractEntityPersister
return true;
}
@Override
public boolean isSubclassPropertyNullable(int i) {
return subclassPropertyNullabilityClosure[i];
}
@ -4404,6 +4459,7 @@ public abstract class AbstractEntityPersister
* @return {@code null} or the indices of the dirty properties
*
*/
@Override
public int[] findDirty(Object[] currentState, Object[] previousState, Object entity, SharedSessionContractImplementor session)
throws HibernateException {
int[] props = DirtyHelper.findDirty(
@ -4433,6 +4489,7 @@ public abstract class AbstractEntityPersister
* @return {@code null} or the indices of the modified properties
*
*/
@Override
public int[] findModified(Object[] old, Object[] current, Object entity, SharedSessionContractImplementor session)
throws HibernateException {
int[] props = DirtyHelper.findModified(
@ -4471,10 +4528,12 @@ public abstract class AbstractEntityPersister
}
}
@Override
public SessionFactoryImplementor getFactory() {
return factory;
}
@Override
public EntityMetamodel getEntityMetamodel() {
return entityMetamodel;
}
@ -4489,10 +4548,12 @@ public abstract class AbstractEntityPersister
return canWriteToCache;
}
@Override
public boolean hasCache() {
return canWriteToCache;
}
@Override
public EntityDataAccess getCacheAccessStrategy() {
return cacheAccessStrategy;
}
@ -4507,10 +4568,12 @@ public abstract class AbstractEntityPersister
return cacheEntryHelper.buildCacheEntry( entity, state, version, session );
}
@Override
public boolean hasNaturalIdCache() {
return naturalIdRegionAccessStrategy != null;
}
@Override
public NaturalIdDataAccess getNaturalIdCacheAccessStrategy() {
return naturalIdRegionAccessStrategy;
}
@ -4520,10 +4583,12 @@ public abstract class AbstractEntityPersister
}
// temporary ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@Override
public final String getEntityName() {
return entityMetamodel.getName();
}
@Override
public EntityType getEntityType() {
return entityMetamodel.getEntityType();
}
@ -4532,36 +4597,44 @@ public abstract class AbstractEntityPersister
return entityMetamodel.isPolymorphic();
}
@Override
public boolean isInherited() {
return entityMetamodel.isInherited();
}
@Override
public boolean hasCascades() {
return entityMetamodel.hasCascades();
}
@Override
public boolean hasIdentifierProperty() {
return !entityMetamodel.getIdentifierProperty().isVirtual();
}
@Override
public BasicType<?> getVersionType() {
return entityMetamodel.getVersionProperty() == null
? null
: (BasicType<?>) entityMetamodel.getVersionProperty().getType();
}
@Override
public int getVersionProperty() {
return entityMetamodel.getVersionPropertyIndex();
}
@Override
public boolean isVersioned() {
return entityMetamodel.isVersioned();
}
@Override
public boolean isIdentifierAssignedByInsert() {
return entityMetamodel.getIdentifierProperty().isIdentifierAssignedByInsert();
}
@Override
public boolean hasLazyProperties() {
return entityMetamodel.hasLazyProperties();
}
@ -4576,6 +4649,7 @@ public abstract class AbstractEntityPersister
// }
// }
@Override
public void afterReassociate(Object entity, SharedSessionContractImplementor session) {
if ( getEntityMetamodel().getBytecodeEnhancementMetadata().isEnhancedForLazyLoading() ) {
final BytecodeLazyAttributeInterceptor interceptor = getEntityMetamodel().getBytecodeEnhancementMetadata()
@ -4630,6 +4704,7 @@ public abstract class AbstractEntityPersister
);
}
@Override
public Boolean isTransient(Object entity, SharedSessionContractImplementor session) throws HibernateException {
final Object id;
if ( canExtractIdOutOfEntity() ) {
@ -4674,14 +4749,17 @@ public abstract class AbstractEntityPersister
return null;
}
@Override
public boolean hasCollections() {
return entityMetamodel.hasCollections();
}
@Override
public boolean hasMutableProperties() {
return entityMetamodel.hasMutableProperties();
}
@Override
public boolean isMutable() {
return entityMetamodel.isMutable();
}
@ -4690,19 +4768,23 @@ public abstract class AbstractEntityPersister
return ( entry == null ? isMutable() : entry.isModifiableEntity() );
}
@Override
public boolean isAbstract() {
return entityMetamodel.isAbstract();
}
@Override
public boolean hasSubclasses() {
return entityMetamodel.hasSubclasses();
}
@Override
public boolean hasProxy() {
// skip proxy instantiation if entity is bytecode enhanced
return entityMetamodel.isLazy() && !entityMetamodel.getBytecodeEnhancementMetadata().isEnhancedForLazyLoading();
}
@Override
public IdentifierGenerator getIdentifierGenerator() throws HibernateException {
return entityMetamodel.getIdentifierProperty().getIdentifierGenerator();
}
@ -4715,50 +4797,54 @@ public abstract class AbstractEntityPersister
return identityDelegate;
}
@Override
public String getRootEntityName() {
return entityMetamodel.getRootName();
}
@Override @Deprecated
public ClassMetadata getClassMetadata() {
return this;
}
@Override
public String getMappedSuperclass() {
return entityMetamodel.getSuperclass();
}
@Override
public boolean isExplicitPolymorphism() {
return entityMetamodel.isExplicitPolymorphism();
}
public boolean hasEmbeddedCompositeIdentifier() {
return entityMetamodel.getIdentifierProperty().isEmbedded();
}
@Override
public boolean canExtractIdOutOfEntity() {
return hasIdentifierProperty() || hasEmbeddedCompositeIdentifier() || hasIdentifierMapper();
}
private boolean hasIdentifierMapper() {
return entityMetamodel.getIdentifierProperty().hasIdentifierMapper();
return hasIdentifierProperty()
|| entityMetamodel.getIdentifierProperty().isEmbedded()
|| entityMetamodel.getIdentifierProperty().hasIdentifierMapper();
}
@Override
public String[] getKeyColumnNames() {
return getIdentifierColumnNames();
}
@Override
public String getName() {
return getEntityName();
}
@Override
public boolean isCollection() {
return false;
}
@Override
public boolean consumesEntityAlias() {
return true;
}
@Override
public boolean consumesCollectionAlias() {
return false;
}
@ -4778,10 +4864,12 @@ public abstract class AbstractEntityPersister
return propertyMapping.toType( propertyName );
}
@Override
public Type getType() {
return entityMetamodel.getEntityType();
}
@Override
public boolean isSelectBeforeUpdateRequired() {
return entityMetamodel.isSelectBeforeUpdate();
}
@ -4790,31 +4878,38 @@ public abstract class AbstractEntityPersister
return entityMetamodel.getOptimisticLockStyle();
}
@Override
public Object createProxy(Object id, SharedSessionContractImplementor session) throws HibernateException {
return representationStrategy.getProxyFactory().getProxy( id, session );
}
@Override
public String toString() {
return StringHelper.unqualify( getClass().getName() ) +
'(' + entityMetamodel.getName() + ')';
return StringHelper.unqualify( getClass().getName() )
+ '(' + entityMetamodel.getName() + ')';
}
@Override
public boolean isInstrumented() {
return entityMetamodel.getBytecodeEnhancementMetadata().isEnhancedForLazyLoading();
}
@Override
public boolean hasInsertGeneratedProperties() {
return entityMetamodel.hasInsertGeneratedValues();
}
@Override
public boolean hasUpdateGeneratedProperties() {
return entityMetamodel.hasUpdateGeneratedValues();
}
@Override
public boolean isVersionPropertyGenerated() {
return isVersioned() && getEntityMetamodel().isVersionGenerated();
}
@Override
public boolean isVersionPropertyInsertable() {
return isVersioned() && getPropertyInsertability()[getVersionProperty()];
}
@ -4844,22 +4939,27 @@ public abstract class AbstractEntityPersister
}
}
@Override
public String[] getPropertyNames() {
return entityMetamodel.getPropertyNames();
}
@Override
public Type[] getPropertyTypes() {
return entityMetamodel.getPropertyTypes();
}
@Override
public boolean[] getPropertyLaziness() {
return entityMetamodel.getPropertyLaziness();
}
@Override
public boolean[] getPropertyUpdateability() {
return entityMetamodel.getPropertyUpdateability();
}
@Override
public boolean[] getPropertyCheckability() {
return entityMetamodel.getPropertyCheckability();
}
@ -4868,30 +4968,37 @@ public abstract class AbstractEntityPersister
return entityMetamodel.getNonlazyPropertyUpdateability();
}
@Override
public boolean[] getPropertyInsertability() {
return entityMetamodel.getPropertyInsertability();
}
@Override
public boolean[] getPropertyNullability() {
return entityMetamodel.getPropertyNullability();
}
@Override
public boolean[] getPropertyVersionability() {
return entityMetamodel.getPropertyVersionability();
}
@Override
public CascadeStyle[] getPropertyCascadeStyles() {
return entityMetamodel.getCascadeStyles();
}
@Override
public final Class<?> getMappedClass() {
return this.getMappedJavaType().getJavaTypeClass();
}
@Override
public boolean implementsLifecycle() {
return Lifecycle.class.isAssignableFrom( getMappedClass() );
}
@Override
public Class<?> getConcreteProxyClass() {
final JavaType<?> proxyJavaType = getRepresentationStrategy().getProxyJavaType();
return proxyJavaType != null ? proxyJavaType.getJavaTypeClass() : javaType.getJavaTypeClass();
@ -5152,6 +5259,7 @@ public abstract class AbstractEntityPersister
return entityMetamodel.getPropertySpan();
}
@Override
public Object[] getPropertyValuesToInsert(Object entity, Map mergeMap, SharedSessionContractImplementor session)
throws HibernateException {
if ( shouldGetAllProperties( entity ) && accessOptimizer != null ) {
@ -5178,6 +5286,7 @@ public abstract class AbstractEntityPersister
return !bytecodeEnhancementMetadata.hasUnFetchedAttributes( entity );
}
@Override
public void processInsertGeneratedProperties(
Object id,
Object entity,
@ -5195,6 +5304,7 @@ public abstract class AbstractEntityPersister
);
}
@Override
public void processUpdateGeneratedProperties(
Object id,
Object entity,
@ -5211,18 +5321,22 @@ public abstract class AbstractEntityPersister
);
}
@Override
public String getIdentifierPropertyName() {
return entityMetamodel.getIdentifierProperty().getName();
}
@Override
public Type getIdentifierType() {
return entityMetamodel.getIdentifierProperty().getType();
}
@Override
public boolean hasSubselectLoadableCollections() {
return hasSubselectLoadableCollections;
}
@Override
public int[] getNaturalIdentifierProperties() {
return entityMetamodel.getNaturalIdentifierProperties();
}
@ -5233,6 +5347,7 @@ public abstract class AbstractEntityPersister
}
}
@Override
public Object getNaturalIdentifierSnapshot(Object id, SharedSessionContractImplementor session) {
verifyHasNaturalId();
@ -5288,10 +5403,12 @@ public abstract class AbstractEntityPersister
return getNaturalIdLoader().resolveNaturalIdToId( naturalIdValues, session );
}
@Override
public boolean hasNaturalIdentifier() {
return entityMetamodel.hasNaturalIdentifier();
}
@Override
public void setPropertyValue(Object object, String propertyName, Object value) {
final AttributeMapping attributeMapping = (AttributeMapping) findSubPart( propertyName, this );
final AttributeMetadata attributeMetadata = attributeMapping.getAttributeMetadataAccess().resolveAttributeMetadata( this );
@ -5754,6 +5871,7 @@ public abstract class AbstractEntityPersister
return sqmMultiTableMutationStrategy;
}
@Override
public SqmMultiTableInsertStrategy getSqmMultiTableInsertStrategy() {
return sqmMultiTableInsertStrategy;
}

View File

@ -788,6 +788,7 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
return isInverseTable[j];
}
@Override
protected boolean isSubclassTableSequentialSelect(int j) {
return subclassTableSequentialSelect[j] && !isClassOrSuperclassTable[j];
}
@ -798,6 +799,7 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
loader = createEntityLoader(LockMode.NONE, CollectionHelper.EMPTY_MAP);
}*/
@Override
public String getSubclassPropertyTableName(int i) {
return subclassTableNameClosure[subclassPropertyTableNumberClosure[i]];
}
@ -812,10 +814,12 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
return isNullableSubclassTable[j];
}
@Override
public Type getDiscriminatorType() {
return discriminatorType;
}
@Override
public Object getDiscriminatorValue() {
return discriminatorValue;
}
@ -842,10 +846,12 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
return getDiscriminatorColumnName();
}
@Override
public String getDiscriminatorAlias() {
return discriminatorAlias;
}
@Override
public String getSubclassForDiscriminatorValue(Object value) {
if ( value == null ) {
return subclassesByDiscriminatorValue.get( NULL_DISCRIMINATOR );
@ -866,23 +872,28 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
}
}
@Override
public Serializable[] getPropertySpaces() {
return spaces; // don't need subclass tables, because they can't appear in conditions
}
@Override
public String getTableName(int j) {
return naturalOrderTableNames[j];
}
@Override
public String[] getKeyColumns(int j) {
return naturalOrderTableKeyColumns[j];
}
@Override
public boolean isTableCascadeDeleteEnabled(int j) {
return naturalOrderCascadeDeleteEnabled[j];
}
@Override
public boolean isPropertyOfTable(int property, int j) {
return naturalOrderPropertyTableNumbers[property] == j;
}
@ -927,10 +938,12 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
return temp;
}
@Override
public String fromTableFragment(String alias) {
return getTableName() + ' ' + alias;
}
@Override
public String getTableName() {
return tableNames[0];
}
@ -955,18 +968,22 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
return filterFragment( alias );
}
@Override
public String generateFilterConditionAlias(String rootAlias) {
return generateTableAlias( rootAlias, tableSpan - 1 );
}
@Override
public String generateWhereConditionAlias(String rootAlias) {
return generateTableAlias( rootAlias, tableSpan - 1 );
}
@Override
public String[] getIdentifierColumnNames() {
return tableKeyColumns[0];
}
@Override
public String[] getIdentifierColumnReaderTemplates() {
return tableKeyColumnReaderTemplates[0];
}
@ -976,42 +993,52 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
return naturalOrderTableNames[0];
}
@Override
public String[] getIdentifierColumnReaders() {
return tableKeyColumnReaders[0];
}
@Override
protected int[] getPropertyTableNumbersInSelect() {
return propertyTableNumbers;
}
@Override
protected int getSubclassPropertyTableNumber(int i) {
return subclassPropertyTableNumberClosure[i];
}
@Override
public int getTableSpan() {
return tableSpan;
}
@Override
public boolean isMultiTable() {
return true;
}
@Override
protected int[] getSubclassColumnTableNumberClosure() {
return subclassColumnTableNumberClosure;
}
@Override
protected int[] getSubclassFormulaTableNumberClosure() {
return subclassFormulaTableNumberClosure;
}
@Override
protected int[] getPropertyTableNumbers() {
return naturalOrderPropertyTableNumbers;
}
@Override
protected String[] getSubclassTableKeyColumns(int j) {
return subclassTableKeyColumnClosure[j];
}
@Override
public String getSubclassTableName(int j) {
return subclassTableNameClosure[j];
}
@ -1021,10 +1048,12 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
return subclassTableNameClosure;
}
@Override
public int getSubclassTableSpan() {
return subclassTableNameClosure.length;
}
@Override
protected boolean isSubclassTableLazy(int j) {
return subclassTableIsLazyClosure[j];
}
@ -1034,6 +1063,7 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
return false;
}
@Override
protected boolean isClassOrSuperclassTable(int j) {
return isClassOrSuperclassTable[j];
}
@ -1082,18 +1112,22 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
return tableNames[propertyTableNumbers[index]];
}
@Override
public String[] getConstraintOrderedTableNameClosure() {
return constraintOrderedTableNames;
}
@Override
public String[][] getContraintOrderedTableKeyColumnClosure() {
return constraintOrderedKeyColumnNames;
}
@Override
public String getRootTableAlias(String drivingAlias) {
return generateTableAlias( drivingAlias, getTableId( getRootTableName(), tableNames ) );
}
@Override
public Declarer getSubclassPropertyDeclarer(String propertyPath) {
if ( "class".equals( propertyPath ) ) {
// special case where we need to force include all subclass joins
@ -1241,6 +1275,7 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
return null;
}
@Override
protected EntityIdentifierMapping generateNonEncapsulatedCompositeIdentifierMapping(
MappingModelCreationProcess creationProcess,
PersistentClass bootEntityDescriptor) {

View File

@ -257,7 +257,7 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
isNullables.add( join.isOptional() );
isLazies.add( lazyAvailable && join.isLazy() );
boolean isDeferred = join.isSequentialSelect() && ! persistentClass.isClassOrSuperclassJoin( join ) ;
boolean isDeferred = join.isSequentialSelect() && !persistentClass.isClassOrSuperclassJoin( join ) ;
isDeferreds.add( isDeferred );
String joinTableName = determineTableName( join.getTable() );
@ -457,46 +457,57 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
}
}
@Override
public boolean isInverseTable(int j) {
return isInverseTable[j];
}
@Override
protected boolean isInverseSubclassTable(int j) {
return isInverseSubclassTable[j];
}
@Override
public String getDiscriminatorColumnName() {
return discriminatorColumnName;
}
@Override
public String getDiscriminatorColumnReaders() {
return discriminatorColumnReaders;
}
@Override
public String getDiscriminatorColumnReaderTemplate() {
return discriminatorColumnReaderTemplate;
}
@Override
public String getDiscriminatorAlias() {
return discriminatorAlias;
}
@Override
public String getDiscriminatorFormulaTemplate() {
return discriminatorFormulaTemplate;
}
@Override
public String getTableName() {
return qualifiedTableNames[0];
}
@Override
public Type getDiscriminatorType() {
return discriminatorType;
}
@Override
public Object getDiscriminatorValue() {
return discriminatorValue;
}
@Override
public String getDiscriminatorSQLValue() {
return discriminatorSQLValue;
}
@ -505,6 +516,7 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
return subclassClosure;
}
@Override
public String getSubclassForDiscriminatorValue(Object value) {
if ( value == null ) {
return subclassesByDiscriminatorValue.get( NULL_DISCRIMINATOR );
@ -518,6 +530,7 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
}
}
@Override
public Serializable[] getPropertySpaces() {
return spaces;
}
@ -532,28 +545,34 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
return discriminatorFormula;
}
@Override
public String getTableName(int j) {
return qualifiedTableNames[j];
}
@Override
public String[] getKeyColumns(int j) {
return keyColumnNames[j];
}
@Override
public boolean isTableCascadeDeleteEnabled(int j) {
return cascadeDeleteEnabled[j];
}
@Override
public boolean isPropertyOfTable(int property, int j) {
return propertyTableNumbers[property] == j;
}
@Override
protected boolean isSubclassTableSequentialSelect(int j) {
return subclassTableSequentialSelect[j] && !isClassOrSuperclassTable[j];
}
// Execute the SQL:
@Override
public String fromTableFragment(String name) {
return getTableName() + ' ' + name;
}
@ -689,22 +708,27 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
return fullDiscriminatorValues;
}
@Override
public String getSubclassPropertyTableName(int i) {
return subclassTableNameClosure[subclassPropertyTableNumberClosure[i]];
}
@Override
protected int[] getPropertyTableNumbersInSelect() {
return propertyTableNumbers;
}
@Override
protected int getSubclassPropertyTableNumber(int i) {
return subclassPropertyTableNumberClosure[i];
}
@Override
public int getTableSpan() {
return joinSpan;
}
@Override
protected void addDiscriminatorToInsert(Insert insert) {
if ( discriminatorInsertable ) {
@ -713,14 +737,17 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
}
@Override
protected int[] getSubclassColumnTableNumberClosure() {
return subclassColumnTableNumberClosure;
}
@Override
protected int[] getSubclassFormulaTableNumberClosure() {
return subclassFormulaTableNumberClosure;
}
@Override
protected int[] getPropertyTableNumbers() {
return propertyTableNumbers;
}
@ -748,10 +775,12 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
return tabnum == null ? 0 : tabnum;
}
@Override
protected String[] getSubclassTableKeyColumns(int j) {
return subclassTableKeyColumnClosure[j];
}
@Override
public String getSubclassTableName(int j) {
return subclassTableNameClosure[j];
}
@ -761,26 +790,32 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
return subclassTableNameClosure;
}
@Override
public int getSubclassTableSpan() {
return subclassTableNameClosure.length;
}
@Override
protected boolean isClassOrSuperclassTable(int j) {
return isClassOrSuperclassTable[j];
}
@Override
protected boolean isClassOrSuperclassJoin(int j) {
return isClassOrSuperclassJoin[j];
}
@Override
protected boolean isSubclassTableLazy(int j) {
return subclassTableIsLazyClosure[j];
}
@Override
public boolean isNullableTable(int j) {
return isNullableTable[j];
}
@Override
protected boolean isNullableSubclassTable(int j) {
return isNullableSubclassTable[j];
}
@ -799,14 +834,17 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
return true;
}
@Override
public boolean isMultiTable() {
return getTableSpan() > 1;
}
@Override
public String[] getConstraintOrderedTableNameClosure() {
return constraintOrderedTableNames;
}
@Override
public String[][] getContraintOrderedTableKeyColumnClosure() {
return constraintOrderedKeyColumnNames;
}

View File

@ -278,12 +278,7 @@ public class UnionSubclassEntityPersister extends AbstractEntityPersister {
@Override
public String getTableName() {
if ( hasSubclasses() ) {
return subquery;
}
else {
return tableName;
}
return hasSubclasses() ? subquery : tableName;
}
@Override
@ -419,10 +414,7 @@ public class UnionSubclassEntityPersister extends AbstractEntityPersister {
@Override
protected EntityDiscriminatorMapping generateDiscriminatorMapping(MappingModelCreationProcess modelCreationProcess) {
if ( hasSubclasses() ) {
return super.generateDiscriminatorMapping( modelCreationProcess );
}
return null;
return hasSubclasses() ? super.generateDiscriminatorMapping(modelCreationProcess) : null;
}
@Override
@ -455,9 +447,7 @@ public class UnionSubclassEntityPersister extends AbstractEntityPersister {
SqlStringGenerationContext sqlStringGenerationContext = getFactory().getSqlStringGenerationContext();
if ( !model.hasSubclasses() ) {
return model.getTable().getQualifiedName(
sqlStringGenerationContext
);
return model.getTable().getQualifiedName( sqlStringGenerationContext );
}
Set<Column> columns = new LinkedHashSet<>();
@ -530,7 +520,8 @@ public class UnionSubclassEntityPersister extends AbstractEntityPersister {
// Collect the concrete subclass table names for the treated entity names
final Set<String> treatedTableNames = new HashSet<>( treated.size() );
for ( String subclassName : treated ) {
final UnionSubclassEntityPersister subPersister = (UnionSubclassEntityPersister) getSubclassMappingType( subclassName );
final UnionSubclassEntityPersister subPersister =
(UnionSubclassEntityPersister) getSubclassMappingType( subclassName );
for ( String subclassTableName : subPersister.getSubclassTableNames() ) {
if ( ArrayHelper.indexOf( subclassSpaces, subclassTableName ) != -1 ) {
treatedTableNames.add( subclassTableName );