Always use directly mapped property as first choice when resolving ${column_name} in appendFilter().

Only use id/name/prototype if that doesn't give us a value.
This commit is contained in:
hns 2005-05-18 08:33:47 +00:00
parent 3c8f9f8890
commit d26b968ae8

View file

@ -838,19 +838,20 @@ public final class Relation {
Object value = null; Object value = null;
if (columnName != null) { if (columnName != null) {
DbMapping dbmap = nonvirtual.getDbMapping(); DbMapping dbmap = nonvirtual.getDbMapping();
if (columnName.equals(dbmap.getIDField())) { String propertyName = dbmap.columnNameToProperty(columnName);
value = nonvirtual.getID(); if (propertyName != null) {
} else if (columnName.equals(dbmap.getNameField())) { IProperty property = nonvirtual.get(propertyName);
value = nonvirtual.getName(); if (property != null) {
} else if (columnName.equals(dbmap.getPrototypeField())) { value = property.getValue();
value = nonvirtual.getPrototype(); }
} else { }
String propertyName = dbmap.columnNameToProperty(columnName); if (value == null) {
if (propertyName != null) { if (columnName.equals(dbmap.getIDField())) {
IProperty property = nonvirtual.get(propertyName); value = nonvirtual.getID();
if (property != null) { } else if (columnName.equals(dbmap.getNameField())) {
value = property.getValue(); value = nonvirtual.getName();
} } else if (columnName.equals(dbmap.getPrototypeField())) {
value = nonvirtual.getPrototype();
} }
} }
} }