I was trying to use the Tuple option to get the result of fields mix of Entities and sum of values and seems the Studio has a very good option but not sure how to get the Entity and values from the resultList and didn’t find any documentation on it.
This generates:
final List<DpsAcctStatement> dpsAcctStatementList = dataManager.load(DpsAcctStatement.class)
.query("select d.dpsAccount, SUM(d.amount) from dps_DpsAcctStatement d where d.dpsAccount.dpsStatus = :dpsAccountDpsStatus1 group by d.dpsAccount")
.parameter("dpsAccountDpsStatus1", DpsStatus.APPROVED)
.list();
However, when I run, I get the following exception:
DevelopmentException: DataManager cannot execute query for single attributes
Hello I was facing similar puzzle while creating data aggregate, but I was able to get the tuple option from the query builder functional with key value connection
<keyValueCollection id="salesDc">
<properties>
<property name="sp" class="com.company.test2.entity.Serviceplan"/>
<property name="price" datatype="int"/>
</properties>
<loader id="salesDl">
<query>
<![CDATA[select s.vehicle, AVG(s.price)
from Serviceplan s
group by s.vehicle ]]>
</query>
</loader>
</keyValueCollection>