[jboss-user] [EJB 3.0] - Re: Computed Columns in Entities
jlessner
do-not-reply at jboss.com
Thu Mar 1 06:11:31 EST 2007
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
More information about the jboss-user
mailing list