Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
JSP - A mailing list about Java Server Pages specification and reference
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Subject: Servlet : Session invalidate
Oracle Connection Pooling in 3 2 2
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Subject: Running a Simple JMS Example
Tomcat and webapplication specific java library path
Mapping in workers2 properties
org apache jasper JasperException
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action
   MESSAGE
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
Value attribute of <html:checkbox
url string for connecting jboss to oracle
javax servlet ServletException: BeanUtils populate
5 0 18: Windows XP Pro vs Windows 2000
HTTP Status 404 The requested resource is not available
 
Subject: Session - > DAO - > CMP

Subject: Session - > DAO - > CMP

2004-06-09       - By Huy Nguyen

 Back
Reply:     1     2     3     4     5     6     7     8  

There are three logical path

> Session -> BMP ( + DAO for implement DB tx). This is bad choice if your app
is J2EE 1.3 and above. Network round trip (N+1 problem) between DB and Entity
EJB will propably kill your app performance.

> Session -> CMP. You will have better performance and simpler to implement

> Session -> DB (via SQL) good for batch upload or retrieval.

Either of all above wont break your client code. I suggest to use option 2.

good luck!

-h

Guy Katz <gkatz@(protected)> wrote:
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)


huy.nguyen

(t)+612 9271 3241 (e) d_huy_nguyen@(protected)


-- ---- ---- ---- ---- ---- -----
Do you Yahoo!?
Friends.  Fun. Try the all-new Yahoo! Messenger

====================================================================
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)
<DIV>There are three logical path</DIV>
<DIV>&nbsp;</DIV>
<DIV>&gt; Session -&gt; BMP ( +&nbsp;DAO for implement DB tx). This is bad
choice if your app is J2EE 1.3 and above. Network round trip&nbsp;(N+1 problem)
between DB and&nbsp;Entity EJB will propably&nbsp;kill your app&nbsp
;performance.</DIV>
<DIV>&nbsp;</DIV>
<DIV>&gt; Session -&gt; CMP. You will have better performance and simpler to
implement</DIV>
<DIV>&nbsp;</DIV>
<DIV>&gt; Session -&gt; DB (via SQL) good for batch upload or retrieval.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Either of all above wont break your client code. I suggest to use option 2
.</DIV>
<DIV>&nbsp;</DIV>
<DIV>good luck!<BR></DIV>
<DIV>-h</DIV>
<DIV><BR><B><I>Guy Katz &lt;gkatz@(protected)&gt;</I></B> wrote:</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER
-LEFT: #1010ff 2px solid">hi;<BR>using CMP, you bind your self to a DB.<BR>I
makes sense to put a DAO in front of an entity bean (cmp or bmp) if you<BR>want
to abstract your persistence mechanism.<BR>if you do not want to rely on entity
bean for your persistence, than putting<BR>a DAO in front is a good idea. you
will be able to switch between entity<BR>beans, hibernate, jdo and so forth.<BR
>if you are using EJB for your persistence, than I don't see any special<BR
>benefit here.<BR><BR>specifically about what you asked, the situation you
describe fit to having<BR>a BMP entity bean and a DAO behind it (assuming an
EJB centric persistence<BR>mechanism). the BMP will call the DAO of choice
(XMLFileDao, DataBaseDAO).<BR>so as you can understand from my answer.<BR><BR>--
---Original Message-- --<BR>From: Koala [mailto:koala.gnu@(protected)]<BR>Sent:
Wednesday, June 09, 2004 10:25 AM<BR>To:
J2EEPATTERNS-INTEREST@(protected)<BR>Subject: Session -&gt; DAO -&gt; CMP<BR>
<BR><BR>Hi,<BR><BR>I would like to know if it makes sense have DAO in front of
an entity<BR>bean CMP. For example:<BR><BR>Client --&gt; Session Facade --&gt;
DAO --&gt; EntityBean<BR><BR>Probably this scheme could have some advantages:
<BR><BR>1) the back end (DB or XML file) is abstracted. (I can abstract an XML
<BR>file behind a CMP bean?)<BR>2) I can move my application written in DAO
quicly in EJB without<BR>changing client code.<BR><BR>and so on.<BR><BR>But, if
I am writing a new application, does it make sense use this<BR>schema? If so,
what are the advantages?<BR>Thanks for your help in advance.<BR><BR>PS<BR><BR
>if you have links talking about this use of DAO please let me know.<BR>(Do not
send me mail of sites talking about general use of DAO).<BR><BR>===============
=====================================================<BR>Companion Site: http:/
/www.corej2eepatterns.com<BR>J2EE BluePrints:
http://java.sun.com/blueprints/corej2eepatterns<BR>List Archive:<BR>http:/
/archives.java.sun.com/archives/j2eepatterns-interest.html<BR>Unsubscribing:
email "signoff J2EEPATTERNS-INTEREST" to<BR>listserv@(protected)<BR><BR>======
==============================================================<BR>Companion Site
: http://www.corej2eepatterns.com<BR>J2EE BluePrints: http://java.sun.com
/blueprints/corej2eepatterns<BR>List Archive: http://archives.java.sun.com
/archives/j2eepatterns-interest.html<BR>Unsubscribing: email "signoff
J2EEPATTERNS-INTEREST" to listserv@(protected)</BLOCKQUOTE><BR><BR><P><FONT
face=Verdana color=gray>huy.nguyen</FONT></P>
<P><FONT size=1><FONT face=Verdana color=darkred>(t)<FONT color=#000000>+612
9271 3241</FONT> </FONT></FONT><FONT size=1><FONT face=Verdana color=darkred>(e
) </FONT></FONT><A href="mailto:d_huy_nguyen@(protected)"><FONT face=Verdana color
=blue size=1>d_huy_nguyen@(protected)</FONT></A></P><p>
               <hr size=1><font face=arial size=-1>Do you Yahoo!?<br>Friends.
Fun. <a href="http://messenger.yahoo.com/">Try the all-new Yahoo! Messenger</a>
====================================================================
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)

©2008 junlu.com - Jax Systems, LLC, U.S.A.