HHH-15900 Make SelectGenerator not extend IdentityGenerator

This commit is contained in:
Marco Belladelli 2022-12-16 17:49:09 +01:00 committed by Gavin King
parent 86ba5144f6
commit 8285eba3ac
1 changed files with 15 additions and 2 deletions

View File

@ -8,14 +8,16 @@ package org.hibernate.id;
import java.util.Properties;
import org.hibernate.dialect.Dialect;
import org.hibernate.generator.InDatabaseGenerator;
import org.hibernate.id.factory.spi.StandardGenerator;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.type.Type;
/**
* A generator that {@code select}s the just-{@code insert}ed row to determine the
* {@code IDENTITY} column value assigned by the database. The correct row is located
* column value assigned by the database. The correct row is located
* using a unique key of the entity, either:
* <ul>
* <li>the mapped {@linkplain org.hibernate.annotations.NaturalId} of the entity, or
@ -32,7 +34,8 @@ import org.hibernate.type.Type;
*
* @author Gavin King
*/
public class SelectGenerator extends IdentityGenerator {
public class SelectGenerator
implements PostInsertIdentifierGenerator, BulkInsertionCapableIdentifierGenerator, StandardGenerator {
private String uniqueKeyPropertyName;
@Override
@ -66,4 +69,14 @@ public class SelectGenerator extends IdentityGenerator {
}
return persister.getPropertyNames()[naturalIdPropertyIndices[0]];
}
@Override
public boolean referenceColumnsInSql(Dialect dialect) {
return false;
}
@Override
public String[] getReferencedColumnValues(Dialect dialect) {
return new String[0];
}
}