Subject: Session - > DAO - > CMP 2004-06-14 - By Chad Woolley
Back Koala <koala.gnu@(protected)> wrote:
> So, if my application use only EJB for persistence it makes no sense use > DAO. > > But, as you said above, if this is not the case (I have persistence > layer implemented in EJB, SQL, JDO etc) I can use this solution. > > At this point the question is: is it possible have an application with a > persistence layer implemented with EJB, SQL, JDO, Hibernate and so on? > > I know that in some EJB application could be useful use SQL for BULK > operations. In this case what should be the approach? I mean, is DAO > sufficient > for abstraction or I need others patterns? > > Again, is it possible use EJB, JDO and Hibernate (or other persistent > mechanism) at the same time? If, so can you tell me an example?
Yes, it's definitely possible to use different persistence mechanisms in the same app (assuming you deal with any possible contention/integrity issues if they use the same data source).
On your larger question, I think that the confusion is using the term "DAO". A "DAO" (at least within the context of this list and the Sun J2EE patterns book) refers to a specific pattern where you are writing your persistence code yourself in java.
If you are simply using a DAO as a layer to abstract access to another persistence mechanism, then it is not truly a "DAO". In this case, it is really just a specialized implemtation of the standard "Facade" pattern. You may expose your basic CRUD (create read update delete) methods via this facade so that is LOOKS like a DAO, but I still don't think this makes it an official "DAO" as defined in the Sun J2EE patterns book.
However, if it makes you happy to call it a DAO, then by all means do so :)
Make sense? Hope it helps.
-- Chad
==================================================================== Companion Site: http://www.corej2eepatterns.com J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)
|
|