Fix for #102 - When using @Transient along with @Formula I'm not seeing any values in the field.

This commit is contained in:
Rob Bygrave
2014-05-14 23:35:15 +12:00
parent 2055349d76
commit fcbedda597
3 changed files with 13 additions and 1 deletions
@@ -977,6 +977,13 @@ public class BeanProperty implements ElPropertyValue {
return isTransient;
}
/**
* Return true if this property is loadable from a resultSet.
*/
public boolean isLoadProperty() {
return !isTransient || formula;
}
/**
* Return true if this is a version column used for concurrency checking.
*/
@@ -56,7 +56,7 @@ public class SqlBeanLoad {
public Object load(BeanProperty prop) throws SQLException {
if (!rawSql && prop.isTransient()) {
if (!rawSql && !prop.isLoadProperty()) {
return null;
}
@@ -24,6 +24,11 @@ public class TestFormulaWithFindCount extends BaseTestCase {
ExpressionList<Order> ex = server.find(Order.class).select("id, status ,totalAmount").where().gt("totalAmount", 1d);
List<Order> list = ex.findList();
for (Order order : list) {
Double amount = order.getTotalAmount();
Assert.assertNotNull(amount);
}
ExpressionList<Order> expressionList = server.find(Order.class).where().gt("totalAmount", 1d);
int rowCount = expressionList.findRowCount();