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 jakarta.persistence.criteria.CriteriaBuilder; import jakarta.persistence.criteria.CriteriaBuilder;
import jakarta.persistence.criteria.CriteriaQuery; import jakarta.persistence.criteria.CriteriaQuery;
import org.hibernate.Session;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;

View File

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

View File

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

View File

@ -431,6 +431,7 @@ public void setIdentifierGeneratorStrategy(String identifierGeneratorStrategy) {
} }
@Deprecated @Deprecated
@Override
public boolean isIdentityColumn(IdentifierGeneratorFactory identifierGeneratorFactory, Dialect dialect) { public boolean isIdentityColumn(IdentifierGeneratorFactory identifierGeneratorFactory, Dialect dialect) {
return IdentityGenerator.class.isAssignableFrom( return IdentityGenerator.class.isAssignableFrom(
identifierGeneratorFactory.getIdentifierGeneratorClass( identifierGeneratorStrategy ) identifierGeneratorFactory.getIdentifierGeneratorClass( identifierGeneratorStrategy )

View File

@ -245,8 +245,7 @@ public UnionSubclassEntityPersister(
protected void validateGenerator() { protected void validateGenerator() {
if ( getGenerator() instanceof IdentityGenerator ) { 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,10 +175,12 @@ private static boolean isPrimaryKeyIdentity(Table table, Metadata metadata, Dial
MetadataImplementor metadataImplementor = (MetadataImplementor) metadata; MetadataImplementor metadataImplementor = (MetadataImplementor) metadata;
return table.hasPrimaryKey() return table.hasPrimaryKey()
&& table.getIdentifierValue() != null && table.getIdentifierValue() != null
&& table.getIdentifierValue().isIdentityColumn( && table.getIdentifierValue()
metadataImplementor.getMetadataBuildingOptions().getIdentifierGeneratorFactory(), .isIdentityColumn(
dialect metadataImplementor.getMetadataBuildingOptions()
); .getIdentifierGeneratorFactory(),
dialect
);
} }
private static String stripArgs(String string) { private static String stripArgs(String string) {

View File

@ -680,6 +680,9 @@ public boolean isNaturalIdentifierInsertGenerated() {
// Assumptions: // Assumptions:
// * That code checks that there is a natural identifier before making this call, so we assume the same here // * 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 // * 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] ]; final Generator strategy = generators[ naturalIdPropertyNumbers[0] ];
return strategy != null && strategy.generatesSometimes(); return strategy != null && strategy.generatesSometimes();
} }