Friday, February 9, 2007

Is session bean a coarse grained bean?

YES, session beans are coarse grained bean. Entity beans are fine grained beans.
Actually it depends on how you use them. You can have design in which even Session beans can behave as fine grained beans. One eg. of coarse gained session... Instead of accessing entity beans directly, many a times we use session beans as a wrapper over a number of entity beans in the system. If a business functionality requires access to say 10 entity beans, that functionality can be encapsulated in a single session bean. Thus making it what we say coarse grained. In this case, entity beans can be said as fine grained.
A fine grained entity bean directly mapped to one relational table. A coarse grained entity bean is larger and more complex, either because its attributes include values or lists from other tables, or because it has more sets of dependent objects. The coarse grained bean might be mapped to a single table or flat file.


SOURCE : www.referjava.com

No comments: