#940 - Allow findNative to use @Formula properties (add test for MySql := use with RawSql and findNative)

This commit is contained in:
Rob Bygrave
2017-01-09 22:29:15 +13:00
parent 0efcf1eeb3
commit 8d39b0a996
2 changed files with 56 additions and 2 deletions
@@ -1427,8 +1427,18 @@ public class BeanProperty implements ElPropertyValue, Property {
}
public void registerColumn(BeanDescriptor<?> desc, String prefix) {
if (dbColumn != null) {
desc.registerColumn(dbColumn, SplitName.add(prefix, name));
String path = SplitName.add(prefix, name);
if (formula && dbColumn != null) {
// trim off table alias placeholder if found
String[] split = dbColumn.split("}");
if (split.length == 2) {
desc.registerColumn(split[1], path);
} else {
desc.registerColumn(dbColumn, path);
}
} else if (dbColumn != null) {
desc.registerColumn(dbColumn, path);
}
}
}