[jboss-user] [EJB 3.0] - Re: Computed Columns in Entities
eiben
do-not-reply at jboss.com
Fri Mar 2 02:32:57 EST 2007
Hmm, I was afraid someone would suggest something like this.
Well I could also do something like
| public int getItemsCount()
| {
| this.getOrderitems().size();
| }
| public float getItemTotal()
| {
| float retVal = 0;
|
| for (Orderitem currentOrder : this.getOrderitems())
| {
| retVal += currentOrder.getQuantity() . currentOrder.getItem().getPrice();
| }
|
| return retVal;
| }
|
but I would consider this as sub-optimal, because doing this kind of computation could also be done using the database, and I would say that it would be a little bit faster ...
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4024555#4024555
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4024555
More information about the jboss-user
mailing list