-
Type: Improvement
-
Status: Closed (View Workflow)
-
Priority: Critical
-
Resolution: Fixed
-
Affects Version/s: 0.8
-
Fix Version/s: 0.9
-
Labels:None
-
Environment:
Default
Service and dao methods like getSomethingInSomethingCount() should be removed. Instead model properties with Hivernate "formula" attribute should be used. If, for instance, we need to get a post count for a user we should define User.postCount field and map it as formula with appropriate SQL\HQL query. When we need to render this statistic info we're just calling User.getPostCount() without referring any dao or service objects.
Some count-like queries represents glodal statistics unrelated to any particular entities, like total message/topic conunt for the whole forum. Thesequeries are out of scope of this improvement.
To learn more about Hibernate formulas please refer to http://tim.oreilly.com/pub/a/onjava/2005/08/03/hibernate.html?page=1