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
 
DAO relation with business object

DAO relation with business object

2004-06-28       - By Deblauwe, Wim

 Back
Reply:     1     2     3     4     5  

Hmm... I wasn't aware of that second version of the book:
http://www.corej2eepatterns.com/Patterns2ndEd/DataAccessObject.htm

There seems to be no Business Object anymore like in
http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.ht
ml

I hope the authors of these books are on this list, maybe they can answer
these questions for us ;)

regards,

Wim

-- --Original Message-- --
From: An interest list for Sun Java Center J2EE Pattern Catalog
[mailto:J2EEPATTERNS-INTEREST@(protected)]On Behalf Of Chad Woolley
Sent: zaterdag 26 juni 2004 21:56
To: J2EEPATTERNS-INTEREST@(protected)
Subject: Re: DAO relation with business object


Wim,

Check out my thread in the archives of this list called "What is a Data
Object?":

http://archives.java.sun.com/cgi-bin/wa?A1=ind0401&L=j2eepatterns-interest&D
=0#14

In my opinion, when they upgraded the book for the second edition, they left
some subtle but big holes in explaining just what is a "Data Object",
"Transfer
Object", "Value Object" (which is apparently replaced by Transfer Object but
still referenced in the second edition index), and "Business Object".

In addition to the thread (for which I never got a satisfactory answer),
emails
to the authors got no response...

Also, it will be interesting to see how the "Core J2EE Patterns" evolve with
the
apparent direction of the EJB spec towards supporting "Dependency
Injection".  I
would think that it would result in some major changes to these patterns :)

Good Luck,
Chad


"Deblauwe, Wim" <wim.deblauwe@(protected)> wrote:
> Hi,
>
> I've looking at the DAO pattern lately and have some problems with it.
> Especially what is ment by Business Object and ValueObject?
>
> In my words I would call a class User that is a POJO a Business Object,
and
> I would place it in a package "business".
>
> I would then have a class ValueUser in my data package that has all the
same
> methods as business.User. In fact, business.User is just a delegate to
> data.ValueUser.
>
> Is this already correct? Or is the business class something else and is my
> User class already a ValueObject?
>
> 2nd problem:
> When I then create my DAO, e.g. UserDAO. This would typically reside in
the
> data package. There are 2 options then:
>
> public User getUser(int id);
>
> or
>
> public ValueUser getUser(id);
>
> If my business.User class is already a ValueObject, then a class from my
> data-layer is dependant on a class from my business-layer. This would be
> undesirable I think.
> Otherwise we refer to the ValueUser which is in the same layer, so this
> seems ok. But when you try to unit-test User when it is just a delegate
for
> ValueUser, you will do this:
>
> ValueUser valueUser = new ValueUser();
> valueUser.setName( "testName" );
> ... some more here
>
> User user = new User();
> user.setValueObject( valueUser );
>
> assertEquals( user.getName(), "testName" );
>
> And I really don't like this. You have to create 2 objects, where 1 should
> be enough.
>
>
> I hope the people on this list can help me find some answers,
>
> bye,
>
> Wim

====================================================================
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)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2658.2">
<TITLE>RE: DAO relation with business object</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>Hmm... I wasn't aware of that second version of the book:</FONT>
<BR><FONT SIZE=2><A HREF="http://www.corej2eepatterns.com/Patterns2ndEd
/DataAccessObject.htm" TARGET="_blank">http://www.corej2eepatterns.com
/Patterns2ndEd/DataAccessObject.htm</A></FONT>
</P>

<P><FONT SIZE=2>There seems to be no Business Object anymore like in <A HREF=
"http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html"
TARGET="_blank">http://java.sun.com/blueprints/corej2eepatterns/Patterns
/DataAccessObject.html</A></FONT></P>

<P><FONT SIZE=2>I hope the authors of these books are on this list, maybe they
can answer these questions for us ;)</FONT>
</P>

<P><FONT SIZE=2>regards,</FONT>
</P>

<P><FONT SIZE=2>Wim</FONT>
</P>

<P><FONT SIZE=2>-- --Original Message-- --</FONT>
<BR><FONT SIZE=2>From: An interest list for Sun Java Center J2EE Pattern
Catalog</FONT>
<BR><FONT SIZE=2>[<A HREF="mailto:J2EEPATTERNS-INTEREST@(protected)">mailto
:J2EEPATTERNS-INTEREST@(protected)</A>]On Behalf Of Chad Woolley</FONT>
<BR><FONT SIZE=2>Sent: zaterdag 26 juni 2004 21:56</FONT>
<BR><FONT SIZE=2>To: J2EEPATTERNS-INTEREST@(protected)</FONT>
<BR><FONT SIZE=2>Subject: Re: DAO relation with business object</FONT>
</P>
<BR>

<P><FONT SIZE=2>Wim,</FONT>
</P>

<P><FONT SIZE=2>Check out my thread in the archives of this list called &quot
;What is a Data Object?&quot;:</FONT>
</P>

<P><FONT SIZE=2><A HREF="http://archives.java.sun.com/cgi-bin/wa?A1=ind0401&L
=j2eepatterns-interest&D=0#14" TARGET="_blank">http://archives.java.sun.com/cgi
-bin/wa?A1=ind0401&L=j2eepatterns-interest&D=0#14</A></FONT>
</P>

<P><FONT SIZE=2>In my opinion, when they upgraded the book for the second
edition, they left</FONT>
<BR><FONT SIZE=2>some subtle but big holes in explaining just what is a &quot
;Data Object&quot;, &quot;Transfer</FONT>
<BR><FONT SIZE=2>Object&quot;, &quot;Value Object&quot; (which is apparently
replaced by Transfer Object but</FONT>
<BR><FONT SIZE=2>still referenced in the second edition index), and &quot
;Business Object&quot;.</FONT>
</P>

<P><FONT SIZE=2>In addition to the thread (for which I never got a satisfactory
answer), emails</FONT>
<BR><FONT SIZE=2>to the authors got no response...</FONT>
</P>

<P><FONT SIZE=2>Also, it will be interesting to see how the &quot;Core J2EE
Patterns&quot; evolve with the</FONT>
<BR><FONT SIZE=2>apparent direction of the EJB spec towards supporting &quot
;Dependency Injection&quot;.&nbsp; I</FONT>
<BR><FONT SIZE=2>would think that it would result in some major changes to
these patterns :)</FONT>
</P>

<P><FONT SIZE=2>Good Luck,</FONT>
<BR><FONT SIZE=2>Chad</FONT>
</P>
<BR>

<P><FONT SIZE=2>&quot;Deblauwe, Wim&quot; &lt;wim.deblauwe@(protected)&gt; wrote:
</FONT>
<BR><FONT SIZE=2>&gt; Hi,</FONT>
<BR><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>&gt; I've looking at the DAO pattern lately and have some
problems with it.</FONT>
<BR><FONT SIZE=2>&gt; Especially what is ment by Business Object and
ValueObject?</FONT>
<BR><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>&gt; In my words I would call a class User that is a POJO a
Business Object, and</FONT>
<BR><FONT SIZE=2>&gt; I would place it in a package &quot;business&quot;.</FONT>
<BR><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>&gt; I would then have a class ValueUser in my data package
that has all the same</FONT>
<BR><FONT SIZE=2>&gt; methods as business.User. In fact, business.User is just
a delegate to</FONT>
<BR><FONT SIZE=2>&gt; data.ValueUser.</FONT>
<BR><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>&gt; Is this already correct? Or is the business class
something else and is my</FONT>
<BR><FONT SIZE=2>&gt; User class already a ValueObject?</FONT>
<BR><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>&gt; 2nd problem:</FONT>
<BR><FONT SIZE=2>&gt; When I then create my DAO, e.g. UserDAO. This would
typically reside in the</FONT>
<BR><FONT SIZE=2>&gt; data package. There are 2 options then:</FONT>
<BR><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>&gt; public User getUser(int id);</FONT>
<BR><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>&gt; or</FONT>
<BR><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>&gt; public ValueUser getUser(id);</FONT>
<BR><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>&gt; If my business.User class is already a ValueObject, then
a class from my</FONT>
<BR><FONT SIZE=2>&gt; data-layer is dependant on a class from my business-layer
. This would be</FONT>
<BR><FONT SIZE=2>&gt; undesirable I think.</FONT>
<BR><FONT SIZE=2>&gt; Otherwise we refer to the ValueUser which is in the same
layer, so this</FONT>
<BR><FONT SIZE=2>&gt; seems ok. But when you try to unit-test User when it is
just a delegate for</FONT>
<BR><FONT SIZE=2>&gt; ValueUser, you will do this:</FONT>
<BR><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>&gt; ValueUser valueUser = new ValueUser();</FONT>
<BR><FONT SIZE=2>&gt; valueUser.setName( &quot;testName&quot; );</FONT>
<BR><FONT SIZE=2>&gt; ... some more here</FONT>
<BR><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>&gt; User user = new User();</FONT>
<BR><FONT SIZE=2>&gt; user.setValueObject( valueUser );</FONT>
<BR><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>&gt; assertEquals( user.getName(), &quot;testName&quot; );<
/FONT>
<BR><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>&gt; And I really don't like this. You have to create 2
objects, where 1 should</FONT>
<BR><FONT SIZE=2>&gt; be enough.</FONT>
<BR><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>&gt; I hope the people on this list can help me find some
answers,</FONT>
<BR><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>&gt; bye,</FONT>
<BR><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>&gt; Wim</FONT>
</P>

<P><FONT SIZE=2>===============================================================
=====</FONT>
<BR><FONT SIZE=2>Companion Site: <A HREF="http://www.corej2eepatterns.com"
TARGET="_blank">http://www.corej2eepatterns.com</A></FONT>
<BR><FONT SIZE=2>J2EE BluePrints: <A HREF="http://java.sun.com/blueprints
/corej2eepatterns" TARGET="_blank">http://java.sun.com/blueprints
/corej2eepatterns</A></FONT>
<BR><FONT SIZE=2>List Archive: <A HREF="http://archives.java.sun.com/archives
/j2eepatterns-interest.html" TARGET="_blank">http://archives.java.sun.com
/archives/j2eepatterns-interest.html</A></FONT>
<BR><FONT SIZE=2>Unsubscribing: email &quot;signoff J2EEPATTERNS-INTEREST&quot;
to listserv@(protected)</FONT>
</P>

</BODY>
</HTML>
====================================================================
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.