The only portable way I know is by queries which return both, the actual entity 
and the computed value as two different result elements, e.g.

EntityManager em;

Query q = em.createQuery("SELECT o, COUNT(o.positions) FROM OrderEntity o ...");

List<Object[]> results = q.getResultList();

for (Object[] result: results) {
    OrderEntity order = (OrderEntity)result[0];
    order.setPositionCount((Integer)result[1]);
    //... do something with your order
}

This is of course somehow selfmade but maybe it helps :-)

Regards,
Jan

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4024180#4024180

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4024180
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to