very minor code changes

This commit is contained in:
Gavin 2022-12-17 11:02:45 +01:00 committed by Gavin King
parent 8285eba3ac
commit 6536fe0d72
7 changed files with 12 additions and 11 deletions

View File

@ -11,8 +11,6 @@ import java.util.List;
import jakarta.persistence.criteria.CriteriaBuilder;
import jakarta.persistence.criteria.CriteriaQuery;
import org.hibernate.Session;
import org.junit.Assert;
import org.junit.Test;

View File

@ -30,7 +30,6 @@ import org.hibernate.boot.model.relational.SqlStringGenerationContext;
import org.hibernate.boot.spi.SessionFactoryOptions;
import org.hibernate.cache.spi.CacheImplementor;
import org.hibernate.context.spi.CurrentTenantIdentifierResolver;
import org.hibernate.dialect.Dialect;
import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.engine.profile.FetchProfile;
import org.hibernate.event.spi.EventEngine;
@ -165,7 +164,7 @@ public class SessionFactoryDelegatingImpl implements SessionFactoryImplementor,
return delegate.getDefinedFilterNames();
}
@Override
@Override @Deprecated
public FilterDefinition getFilterDefinition(String filterName) throws HibernateException {
return delegate.getFilterDefinition( filterName );
}

View File

@ -30,5 +30,4 @@ public class IdentityGenerator
public String[] getReferencedColumnValues(Dialect dialect) {
return new String[] { dialect.getIdentityColumnSupport().getIdentityInsertString() };
}
}

View File

@ -431,6 +431,7 @@ public abstract class SimpleValue implements KeyValue {
}
@Deprecated
@Override
public boolean isIdentityColumn(IdentifierGeneratorFactory identifierGeneratorFactory, Dialect dialect) {
return IdentityGenerator.class.isAssignableFrom(
identifierGeneratorFactory.getIdentifierGeneratorClass( identifierGeneratorStrategy )

View File

@ -245,8 +245,7 @@ public class UnionSubclassEntityPersister extends AbstractEntityPersister {
protected void validateGenerator() {
if ( getGenerator() instanceof IdentityGenerator ) {
throw new MappingException( "Cannot use identity column key generation with <union-subclass> mapping for: " + getEntityName()
);
throw new MappingException( "Cannot use identity column key generation with <union-subclass> mapping for: " + getEntityName() );
}
}

View File

@ -175,8 +175,10 @@ class ColumnDefinitions {
MetadataImplementor metadataImplementor = (MetadataImplementor) metadata;
return table.hasPrimaryKey()
&& table.getIdentifierValue() != null
&& table.getIdentifierValue().isIdentityColumn(
metadataImplementor.getMetadataBuildingOptions().getIdentifierGeneratorFactory(),
&& table.getIdentifierValue()
.isIdentityColumn(
metadataImplementor.getMetadataBuildingOptions()
.getIdentifierGeneratorFactory(),
dialect
);
}

View File

@ -680,6 +680,9 @@ public class EntityMetamodel implements Serializable {
// Assumptions:
// * That code checks that there is a natural identifier before making this call, so we assume the same here
// * That code assumes a non-composite natural-id, so we assume the same here
if ( naturalIdPropertyNumbers.length < 1 ) {
throw new IllegalStateException( "entity does not have a natural id: " + name );
}
final Generator strategy = generators[ naturalIdPropertyNumbers[0] ];
return strategy != null && strategy.generatesSometimes();
}