[jboss-user] [JBoss Seam] - Re: Dependent Fields in 2 Classes Best Practice?

chuckadams do-not-reply at jboss.com
Sat Mar 17 13:16:13 EDT 2007


You could take the suggestion of using persistence events to accumulate a running tally, but I would at most use such a total to update the UI with a "non-authoritative figure".  Especially for financial data, you should only have one authoritative definition of any figure, and that should be from the only source that is guaranteed to have all the data, and that's the database.  Your app might not be the only thing that ever updates the expenses tables in the future.

You probably don't want to do the sums by fetching all the expense objects though, so you'd be best off with a scalar query, a raw sql query, or best yet, a stored procedure.  It's going to be ridiculously fast in almost any database, and lends itself to optimizations like partitioning if you need it.


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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4029059



More information about the jboss-user mailing list