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)