fixed 33515: NPE in AQB with associated entities if entity has computed columns
authorAsier Lostalé <asier.lostale@openbravo.com>
Thu, 21 Jul 2016 09:12:30 +0200
changeset 30049 b7bce66ab192
parent 30048 734222ff0bdd
child 30050 ea24d6781214
fixed 33515: NPE in AQB with associated entities if entity has computed columns

When AdvancedQueryBuilder was used with the joinAssociatedEntities property set
to true and the queried entity included computed columns, a NPE was trhown.

Fixed by treating computed column property as an special case forcing always
a left join for it.
modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java
--- a/modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java	Tue Jul 19 20:20:24 2016 +0530
+++ b/modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java	Thu Jul 21 09:12:30 2016 +0200
@@ -1835,7 +1835,8 @@
         // if all the identifier properties of the target entity are mandatory, and if the joined
         // entity is used only in where clauses resulting from filtering the grid, an inner join can
         // be used
-        if (KernelUtils.hasNullableIdentifierProperties(property.getTargetEntity())
+        if (Entity.COMPUTED_COLUMNS_PROXY_PROPERTY.equals(property.getName())
+            || KernelUtils.hasNullableIdentifierProperties(property.getTargetEntity())
             || !(Boolean.TRUE.equals(useInnerJoinMap.get(property.getName())))) {
           joinType = " left join ";
         } else {