mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Fix for #102 - When using @Transient along with @Formula I'm not seeing any values in the field.
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user