If we declare an entity-level @Computed(shadowOf=...) then use that class as the default FROM table, duh.

This commit is contained in:
Par Winzell
2007-08-22 05:55:57 +00:00
parent a6f5211db4
commit 470c56d38c
@@ -353,14 +353,20 @@ public abstract class BuildVisitor implements ExpressionVisitor
if (selectClause.getFromOverride() != null) {
selectClause.getFromOverride().accept(this);
} else if (_types.getTableName(pClass) != null) {
_builder.append(" from ");
appendTableName(pClass);
_builder.append(" as ");
appendTableAbbreviation(pClass);
} else {
throw new SQLException("Query on @Computed entity with no FromOverrideClause.");
Computed computed = _types.getMarshaller(pClass).getComputed();
Class<? extends PersistentRecord> tClass;
if (computed != null && !PersistentRecord.class.equals(computed.shadowOf())) {
tClass = computed.shadowOf();
} else if (_types.getTableName(pClass) != null) {
tClass = pClass;
} else {
throw new SQLException("Query on @Computed entity with no FromOverrideClause.");
}
_builder.append(" from ");
appendTableName(tClass);
_builder.append(" as ");
appendTableAbbreviation(tClass);
}
for (Join clause : selectClause.getJoinClauses()) {