Fix issue with AbstractEntityPersister and the creation of the RootTableGroup
This commit is contained in:
parent
16d81eb4bf
commit
8c16e7cfe9
|
@ -387,6 +387,8 @@ public abstract class AbstractEntityPersister
|
|||
|
||||
public abstract String getSubclassTableName(int j);
|
||||
|
||||
protected abstract String[] getSubclassTableNames();
|
||||
|
||||
protected abstract String[] getSubclassTableKeyColumns(int j);
|
||||
|
||||
protected abstract boolean isClassOrSuperclassTable(int j);
|
||||
|
@ -1267,7 +1269,7 @@ public abstract class AbstractEntityPersister
|
|||
lockMode,
|
||||
primaryTableReference,
|
||||
sqlAliasBase,
|
||||
(tableExpression) -> ArrayHelper.contains( rootTableKeyColumnNames, tableExpression ),
|
||||
(tableExpression) -> ArrayHelper.contains( getSubclassTableNames(), tableExpression ),
|
||||
(tableExpression, tableGroup) -> {
|
||||
for ( int i = 0; i < getSubclassTableSpan(); i++ ) {
|
||||
final String subclassTableName = getSubclassTableName( i );
|
||||
|
|
|
@ -1057,6 +1057,11 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
return subclassTableNameClosure[j];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] getSubclassTableNames() {
|
||||
return subclassTableNameClosure;
|
||||
}
|
||||
|
||||
public int getSubclassTableSpan() {
|
||||
return subclassTableNameClosure.length;
|
||||
}
|
||||
|
|
|
@ -809,6 +809,11 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
|
|||
return subclassTableNameClosure[j];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] getSubclassTableNames() {
|
||||
return subclassTableNameClosure;
|
||||
}
|
||||
|
||||
public int getSubclassTableSpan() {
|
||||
return subclassTableNameClosure.length;
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ public class UnionSubclassEntityPersister extends AbstractEntityPersister {
|
|||
private final String subquery;
|
||||
private final String tableName;
|
||||
//private final String rootTableName;
|
||||
private final String[] subclassClosure;
|
||||
private final String[] subclassTableNames;
|
||||
private final String[] spaces;
|
||||
private final String[] subclassSpaces;
|
||||
private final Object discriminatorValue;
|
||||
|
@ -101,7 +101,7 @@ public class UnionSubclassEntityPersister extends AbstractEntityPersister {
|
|||
// TABLE
|
||||
|
||||
tableName = determineTableName( persistentClass.getTable(), jdbcEnvironment );
|
||||
|
||||
subclassTableNames = new String[]{tableName};
|
||||
//Custom SQL
|
||||
|
||||
String sql;
|
||||
|
@ -146,8 +146,6 @@ public class UnionSubclassEntityPersister extends AbstractEntityPersister {
|
|||
// PROPERTIES
|
||||
|
||||
int subclassSpan = persistentClass.getSubclassSpan() + 1;
|
||||
subclassClosure = new String[subclassSpan];
|
||||
subclassClosure[0] = getEntityName();
|
||||
|
||||
// SUBCLASSES
|
||||
subclassByDiscriminatorValue.put(
|
||||
|
@ -159,7 +157,6 @@ public class UnionSubclassEntityPersister extends AbstractEntityPersister {
|
|||
int k = 1;
|
||||
while ( iter.hasNext() ) {
|
||||
Subclass sc = (Subclass) iter.next();
|
||||
subclassClosure[k++] = sc.getEntityName();
|
||||
subclassByDiscriminatorValue.put( sc.getSubclassId(), sc.getEntityName() );
|
||||
}
|
||||
}
|
||||
|
@ -280,10 +277,6 @@ public class UnionSubclassEntityPersister extends AbstractEntityPersister {
|
|||
return discriminatorSQLValue;
|
||||
}
|
||||
|
||||
public String[] getSubclassClosure() {
|
||||
return subclassClosure;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSubclassForDiscriminatorValue(Object value) {
|
||||
return (String) subclassByDiscriminatorValue.get( value );
|
||||
|
@ -519,6 +512,11 @@ public class UnionSubclassEntityPersister extends AbstractEntityPersister {
|
|||
return tableName;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] getSubclassTableNames(){
|
||||
return subclassTableNames;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSubclassTableSpan() {
|
||||
return 1;
|
||||
|
|
Loading…
Reference in New Issue