Thread:
 Granularity 
 anthony   10 Sep 2005, 05:14 

Comment
Prev. thread 
 Next thread
 
Prev. posting 
 Next posting
From: anthony (10 Sep 2005, 05:14) Replies: 0, Views: 36853
Subject: Granularity
Christian said:The DAO interface for a particular entity, that's ok 
but can sometimes think in term of package.

Just one word about granularity, for big projects based on more than 
100 persistent classes, if your design is well done, you'll have 
different packages of 10-30 classes for example.

Use cases should be "driven" by a root entity for each package, so you 
can define one DAO interface per package.

Example: what if you have Order * -- 1 Client and you need to get the 
orders of a particular client? One use case needs only the orders, one 
other also need the client to be fetched. Do you code this in 
ClientDAO or OrderDAO knowing that client is the best candidate to be 
a root entity... 
This one is very simple but think about complex HQL queries on a 4 or 
6 levels object graph. The code is not so easy to add and if you have 
a big development team, there is risk to duplicate the code.

But you need to be carefull when designing your packages...
Prev. thread 
 Next thread
 
Prev. posting 
 Next posting
© Copyright 2006, Red Hat Middleware, LLC. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc. [Privacy Policy]