  | 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
|
|
|
  | | | data update best practices | data update best practices 2004-04-21 - By Ovidiu Pitic
Back Correct. My mistake here. I must have confused Petstore with an application I studied in my early J2EE days (unfortunately I cannot recall which one).
Hope you have enough info without sample code.
Ovidiu
-- --Original Message-- -- From: An interest list for Sun Java Center J2EE Pattern Catalog [mailto:J2EEPATTERNS-INTEREST@(protected)]On Behalf Of Guy Katz Sent: Wednesday, April 21, 2004 14:06 PM To: J2EEPATTERNS-INTEREST@(protected) Subject: Re: data update best practices
thanks. as far as i know. sun did not use any of the methods you suggested. in the petstore, the VOs generation come from the entity beans and hold all the bean's attributes. the user/password attributes are the only attributes of the user EJB and not a custom VO. did i miss what you were trying to say?
-- --Original Message-- -- From: Ovidiu Pitic [mailto:OvidiuP@(protected)] Sent: Wednesday, April 21, 2004 12:39 PM To: J2EEPATTERNS-INTEREST@(protected) Subject: Re: data update best practices
The accepted solution is to use custom value objects that hold only the changed data. For example, if only the user name is changed for a user VO, use a CVO (or CTO) that has only userId and userName as fields. For more info, see Sun's demo apps.
The business object will be responsible of updating only the changed values (in overloaded method that accepts a certain custom VO as parameter).
For complex functionality (which require tens of CVOs), use the dirty mechanism, as it will add insignificant overhead.
Regards, Ovidiu
-- --Original Message-- -- From: Guy Katz [ mailto:gkatz@(protected) <mailto:gkatz@(protected)> ] Sent: Wednesday, April 21, 2004 13:13 To: J2EEPATTERNS-INTEREST@(protected) Subject: Re: data update best practices
hi; maybe i wasnt so clear on my intention.
my dilema is choosing between the foolowing options: 1. application client updates small amount of attributes on my VO -> send it
to the EJB facade -> EJB layer sets all attributes of the VO on the corresponding domain object/s 2. 1. application client updates small amount of atributes on my VO -> send it to the EJB facade -> EJB layer layer sets only changed attributes on corresponding domain object/s.
option number 1 is trivial but has overhead of updating all the VO attributes back to the domain model. options 2 is requires a ' dirty attribute mechanism' which is extra code but
can increase performance.
any sugegstions? know practices for this? thanks.
-- --Original Message-- -- From: Aaron Tubman [ mailto:aharon@(protected) <mailto:aharon@(protected)> ] Sent: Wednesday, April 21, 2004 12:03 PM To: J2EEPATTERNS-INTEREST@(protected) Subject: Re: data update best practices
I suggest to update all the VO fields. In such way you can reuse the same code in different situations while overhead of DB update and object transfer is minor.
Aaron
-- --Original Message-- -- From: An interest list for Sun Java Center J2EE Pattern Catalog
==================================================================== 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=iso-8859 (See http://iso-8859.ora-code.com)-1"> <META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2657.73"> <TITLE>RE: data update best practices</TITLE> </HEAD> <BODY>
<P><FONT SIZE=2>Correct. My mistake here. </FONT> <BR><FONT SIZE=2>I must have confused Petstore with an application I studied in my early J2EE days (unfortunately I cannot recall which one).</FONT></P>
<P><FONT SIZE=2>Hope you have enough info without sample code.</FONT> </P>
<P><FONT SIZE=2>Ovidiu</FONT> </P> <BR> <BR>
<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 Guy Katz</FONT> <BR><FONT SIZE=2>Sent: Wednesday, April 21, 2004 14:06 PM</FONT> <BR><FONT SIZE=2>To: J2EEPATTERNS-INTEREST@(protected)</FONT> <BR><FONT SIZE=2>Subject: Re: data update best practices</FONT> </P> <BR>
<P><FONT SIZE=2>thanks.</FONT> <BR><FONT SIZE=2>as far as i know. sun did not use any of the methods you suggested. in the</FONT> <BR><FONT SIZE=2>petstore, the VOs generation come from the entity beans and hold all the</FONT> <BR><FONT SIZE=2>bean's attributes.</FONT> <BR><FONT SIZE=2>the user/password attributes are the only attributes of the user EJB and not</FONT> <BR><FONT SIZE=2>a custom VO.</FONT> <BR><FONT SIZE=2>did i miss what you were trying to say?</FONT> </P>
<P><FONT SIZE=2>-- --Original Message-- --</FONT> <BR><FONT SIZE=2>From: Ovidiu Pitic [<A HREF="mailto:OvidiuP@(protected)">mailto :OvidiuP@(protected)</A>]</FONT> <BR><FONT SIZE=2>Sent: Wednesday, April 21, 2004 12:39 PM</FONT> <BR><FONT SIZE=2>To: J2EEPATTERNS-INTEREST@(protected)</FONT> <BR><FONT SIZE=2>Subject: Re: data update best practices</FONT> </P> <BR> <BR> <BR>
<P><FONT SIZE=2>The accepted solution is to use custom value objects that hold only the</FONT> <BR><FONT SIZE=2>changed data. For example, if only the user name is changed for a user VO,</FONT> <BR><FONT SIZE=2>use a CVO (or CTO) that has only userId and userName as fields . For more</FONT> <BR><FONT SIZE=2>info, see Sun's demo apps.</FONT> </P>
<P><FONT SIZE=2>The business object will be responsible of updating only the changed values</FONT> <BR><FONT SIZE=2>(in overloaded method that accepts a certain custom VO as parameter).</FONT> </P>
<P><FONT SIZE=2>For complex functionality (which require tens of CVOs), use the dirty</FONT> <BR><FONT SIZE=2>mechanism, as it will add insignificant overhead.</FONT> </P>
<P><FONT SIZE=2>Regards,</FONT> <BR><FONT SIZE=2>Ovidiu</FONT> </P>
<P><FONT SIZE=2>-- --Original Message-- --</FONT> <BR><FONT SIZE=2>From: Guy Katz [ <A HREF="mailto:gkatz@(protected)">mailto:gkatz @(protected)</A> <<A HREF="mailto:gkatz@(protected)">mailto:gkatz@(protected)</A> > ]</FONT> <BR><FONT SIZE=2>Sent: Wednesday, April 21, 2004 13:13</FONT> <BR><FONT SIZE=2>To: J2EEPATTERNS-INTEREST@(protected)</FONT> <BR><FONT SIZE=2>Subject: Re: data update best practices</FONT> </P> <BR>
<P><FONT SIZE=2>hi;</FONT> <BR><FONT SIZE=2>maybe i wasnt so clear on my intention.</FONT> </P>
<P><FONT SIZE=2>my dilema is choosing between the foolowing options:</FONT> <BR><FONT SIZE=2>1. application client updates small amount of attributes on my VO -> send it</FONT> </P>
<P><FONT SIZE=2>to the EJB facade -> EJB layer sets all attributes of the VO on the</FONT> <BR><FONT SIZE=2>corresponding domain object/s</FONT> <BR><FONT SIZE=2>2. 1. application client updates small amount of atributes on my VO -> send</FONT> <BR><FONT SIZE=2>it to the EJB facade -> EJB layer layer sets only changed attributes on</FONT> <BR><FONT SIZE=2>corresponding domain object/s.</FONT> </P>
<P><FONT SIZE=2>option number 1 is trivial but has overhead of updating all the VO</FONT> <BR><FONT SIZE=2>attributes back to the domain model.</FONT> <BR><FONT SIZE=2>options 2 is requires a ' dirty attribute mechanism' which is extra code but</FONT> </P>
<P><FONT SIZE=2>can increase performance.</FONT> </P>
<P><FONT SIZE=2>any sugegstions? know practices for this?</FONT> <BR><FONT SIZE=2>thanks.</FONT> </P>
<P><FONT SIZE=2>-- --Original Message-- --</FONT> <BR><FONT SIZE=2>From: Aaron Tubman [ <A HREF="mailto:aharon@(protected)" >mailto:aharon@(protected)</A></FONT> <BR><FONT SIZE=2><<A HREF="mailto:aharon@(protected)">mailto:aharon @(protected)</A>> ]</FONT> <BR><FONT SIZE=2>Sent: Wednesday, April 21, 2004 12:03 PM</FONT> <BR><FONT SIZE=2>To: J2EEPATTERNS-INTEREST@(protected)</FONT> <BR><FONT SIZE=2>Subject: Re: data update best practices</FONT> </P> <BR>
<P><FONT SIZE=2>I suggest to update all the VO fields. In such way you can reuse the</FONT> <BR><FONT SIZE=2>same code in different situations while overhead of DB update and object</FONT> <BR><FONT SIZE=2>transfer is minor.</FONT> </P>
<P><FONT SIZE=2>Aaron</FONT> </P> <BR>
<P><FONT SIZE=2>-- --Original Message-- --</FONT> <BR><FONT SIZE=2>From: An interest list for Sun Java Center J2EE Pattern Catalog</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 "signoff J2EEPATTERNS-INTEREST" 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)
|
|
 |