diff --git a/src/main/java/com/avaje/ebeaninternal/server/deploy/BeanProperty.java b/src/main/java/com/avaje/ebeaninternal/server/deploy/BeanProperty.java index 4b8d868be..5216f67ce 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/deploy/BeanProperty.java +++ b/src/main/java/com/avaje/ebeaninternal/server/deploy/BeanProperty.java @@ -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. */ diff --git a/src/main/java/com/avaje/ebeaninternal/server/query/SqlBeanLoad.java b/src/main/java/com/avaje/ebeaninternal/server/query/SqlBeanLoad.java index 8acda889f..e158faaf5 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/query/SqlBeanLoad.java +++ b/src/main/java/com/avaje/ebeaninternal/server/query/SqlBeanLoad.java @@ -56,7 +56,7 @@ public class SqlBeanLoad { public Object load(BeanProperty prop) throws SQLException { - if (!rawSql && prop.isTransient()) { + if (!rawSql && !prop.isLoadProperty()) { return null; } diff --git a/src/test/java/com/avaje/tests/query/other/TestFormulaWithFindCount.java b/src/test/java/com/avaje/tests/query/other/TestFormulaWithFindCount.java index 2d9bec246..105028ee7 100644 --- a/src/test/java/com/avaje/tests/query/other/TestFormulaWithFindCount.java +++ b/src/test/java/com/avaje/tests/query/other/TestFormulaWithFindCount.java @@ -24,6 +24,11 @@ public class TestFormulaWithFindCount extends BaseTestCase { ExpressionList ex = server.find(Order.class).select("id, status ,totalAmount").where().gt("totalAmount", 1d); List list = ex.findList(); + + for (Order order : list) { + Double amount = order.getTotalAmount(); + Assert.assertNotNull(amount); + } ExpressionList expressionList = server.find(Order.class).where().gt("totalAmount", 1d); int rowCount = expressionList.findRowCount();