HHH-15761 Validate identifier generator
Having tyhe validation in a separate method, make it possible to extend the class without causing a StackOverflow exception when overriding the getter.
This commit is contained in:
parent
7e36605a75
commit
e84bf71b7f
|
@ -109,15 +109,9 @@ public class UnionSubclassEntityPersister extends AbstractEntityPersister {
|
|||
final EntityDataAccess cacheAccessStrategy,
|
||||
final NaturalIdDataAccess naturalIdRegionAccessStrategy,
|
||||
final RuntimeModelCreationContext creationContext) throws HibernateException {
|
||||
|
||||
super( persistentClass, cacheAccessStrategy, naturalIdRegionAccessStrategy, creationContext );
|
||||
|
||||
if ( getGenerator() instanceof IdentityGenerator ) {
|
||||
throw new MappingException(
|
||||
"Cannot use identity column key generation with <union-subclass> mapping for: " +
|
||||
getEntityName()
|
||||
);
|
||||
}
|
||||
validateGenerator();
|
||||
|
||||
final SessionFactoryImplementor factory = creationContext.getSessionFactory();
|
||||
final Dialect dialect = factory.getJdbcServices().getDialect();
|
||||
|
@ -246,6 +240,13 @@ public class UnionSubclassEntityPersister extends AbstractEntityPersister {
|
|||
postConstruct( creationContext.getMetadata() );
|
||||
}
|
||||
|
||||
protected void validateGenerator() {
|
||||
if ( getGenerator() instanceof IdentityGenerator ) {
|
||||
throw new MappingException( "Cannot use identity column key generation with <union-subclass> mapping for: " + getEntityName()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsTableReference(String tableExpression) {
|
||||
for ( String subclassTableExpression : subclassTableExpressions ) {
|
||||
|
|
Loading…
Reference in New Issue