We want to use the class that owns the column expression rather than supplying

one that may be incorrect.
This commit is contained in:
Michael Bayne
2010-12-08 19:10:45 +00:00
parent ad9f068355
commit 5bdc7d6746
@@ -157,7 +157,7 @@ public abstract class BuildVisitor implements FragmentVisitor<Void>
// object, so we turn on overrides here just as we do when expanding SELECT fields // object, so we turn on overrides here just as we do when expanding SELECT fields
boolean saved = _enableOverrides; boolean saved = _enableOverrides;
_enableOverrides = true; _enableOverrides = true;
appendRhsColumn(pClass, keyFields[ii]); appendRhsColumn(keyFields[ii]);
_enableOverrides = saved; _enableOverrides = saved;
if (values[ii] == null) { if (values[ii] == null) {
_builder.append(" is null "); _builder.append(" is null ");
@@ -243,7 +243,7 @@ public abstract class BuildVisitor implements FragmentVisitor<Void>
public Void visit (ColumnExp<?> columnExp) public Void visit (ColumnExp<?> columnExp)
{ {
appendRhsColumn(columnExp.getPersistentClass(), columnExp); appendRhsColumn(columnExp);
return null; return null;
} }
@@ -377,7 +377,7 @@ public abstract class BuildVisitor implements FragmentVisitor<Void>
// write column to a temporary buffer // write column to a temporary buffer
StringBuilder saved = _builder; StringBuilder saved = _builder;
_builder = new StringBuilder(); _builder = new StringBuilder();
appendRhsColumn(pClass, field); appendRhsColumn(field);
String column = _builder.toString(); String column = _builder.toString();
_builder = saved; _builder = saved;
@@ -796,8 +796,9 @@ public abstract class BuildVisitor implements FragmentVisitor<Void>
// Appends an expression for the given field on the given persistent record; this can // Appends an expression for the given field on the given persistent record; this can
// appear in a SELECT list, in WHERE clauses, etc, etc. // appear in a SELECT list, in WHERE clauses, etc, etc.
protected void appendRhsColumn (Class<? extends PersistentRecord> type, ColumnExp<?> field) protected void appendRhsColumn (ColumnExp<?> field)
{ {
Class<? extends PersistentRecord> type = field.getPersistentClass();
DepotMarshaller<?> dm = _types.getMarshaller(type); DepotMarshaller<?> dm = _types.getMarshaller(type);
if (dm == null) { if (dm == null) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
@@ -989,7 +990,7 @@ public abstract class BuildVisitor implements FragmentVisitor<Void>
protected StringBuilder _builder = new StringBuilder(); protected StringBuilder _builder = new StringBuilder();
/** A mapping of field overrides per persistent record. */ /** A mapping of field overrides per persistent record. */
protected Map<Class<? extends PersistentRecord>, Map<String, FieldDefinition>> _definitions= protected Map<Class<? extends PersistentRecord>, Map<String, FieldDefinition>> _definitions =
Maps.newHashMap(); Maps.newHashMap();
/** Set this to non-null to suppress table abbreviations from being prepended for a class. */ /** Set this to non-null to suppress table abbreviations from being prepended for a class. */