Subject: Session - > DAO - > CMP 2004-06-15 - By Manish Malhotra
Back I think instead of DAO it should be Business Delegate before your EJB's.
regards, Manish
''Its difficult to break a hard nut but its not impossible''
-- --Original Message-- -- From: An interest list for Sun Java Center J2EE Pattern Catalog [mailto:J2EEPATTERNS-INTEREST@(protected)]On Behalf Of Guy Katz Sent: Wednesday, June 09, 2004 3:04 PM To: J2EEPATTERNS-INTEREST@(protected) Subject: Re: Session -> DAO -> CMP
hi; using CMP, you bind your self to a DB. I makes sense to put a DAO in front of an entity bean (cmp or bmp) if you want to abstract your persistence mechanism. if you do not want to rely on entity bean for your persistence, than putting a DAO in front is a good idea. you will be able to switch between entity beans, hibernate, jdo and so forth. if you are using EJB for your persistence, than I don't see any special benefit here.
specifically about what you asked, the situation you describe fit to having a BMP entity bean and a DAO behind it (assuming an EJB centric persistence mechanism). the BMP will call the DAO of choice (XMLFileDao, DataBaseDAO). so as you can understand from my answer.
-- --Original Message-- -- From: Koala [mailto:koala.gnu@(protected)] Sent: Wednesday, June 09, 2004 10:25 AM To: J2EEPATTERNS-INTEREST@(protected) Subject: Session -> DAO -> CMP
Hi,
I would like to know if it makes sense have DAO in front of an entity bean CMP. For example:
Client --> Session Facade --> DAO --> EntityBean
Probably this scheme could have some advantages:
1) the back end (DB or XML file) is abstracted. (I can abstract an XML file behind a CMP bean?) 2) I can move my application written in DAO quicly in EJB without changing client code.
and so on.
But, if I am writing a new application, does it make sense use this schema? If so, what are the advantages? Thanks for your help in advance.
PS
if you have links talking about this use of DAO please let me know. (Do not send me mail of sites talking about general use of DAO).
==================================================================== 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)
==================================================================== 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)
==================================================================== 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)
|
|