Originally posted by Steve Wong:
Is that BMP with DAO instead of Session Facade with DAO is to promote better component-based developement?
Steve.
I think the Session Fa�ade pattern is meant to be used only for the business layer (ie for clients accessing session beans) rather than session beans accessing the database layer (as per Floyd Marinescu’s book – “EJB Design Patterns”, which by the way I think it is a master piece). The idea behind this is that application clients (ie JSPs, Action classes from
struts framework,
java applications…
should not know the guts of the application, thus accessing it via a Fa�ade makes sense. However, I don’t think the same applies for session beans accessing entity beans.
Anyway, I think the decisions an architect should take when designing the database layer are as following:
1) Decide whether to use DAO (light-weight) or entity beans (heavy-weight)
2) If you want to use entity beans, decide whether to use CMP or BMP
3) If you want to use BMPs, decide whether you want to put the SQL statements in the EJB, or move them outside, and I think using DAO for the latter is a good option.
There is a very good discussion on whether
you should use DAOs or entity beans in Floyd’s book (chapter 8). By the way, you can get it online at
www.theserverside.com. Eduard