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
Oracle Connection Pooling in 3 2 2
Servlet : Session invalidate
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Tomcat and webapplication specific java library path
Running a Simple JMS Example
Mapping in workers2 properties
org apache jasper JasperException
Cannot find message resources under key org apache struts action
   MESSAGE
problem with html:text bean throwing exception
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
url string for connecting jboss to oracle
Value attribute of <html:checkbox
javax servlet ServletException: BeanUtils populate
HTTP Status 404 The requested resource is not available
5 0 18: Windows XP Pro vs Windows 2000
 
data update best practices

data update best practices

2004-04-22       - By Chuck

 Back
Reply:     1     2     3     4     5     6     7     8  

I concur with James.  Use (1), unless you have a VERY good reason to use
2,3, or 4.  Since #1 is also the easiest to implement, you could start
off using it, and only move to 2,3, or 4 if you *find* that good reason
to.  I tend to use Just In Time (JIT) complexity.  ;-)

Please make note that the *VALUE OBJECT PATTERN HAS BEEN DEPRECATED IN
FAVOR OF THE TRANSFER OBJECT(TO) PATTERN.*  There are several subtle
differences between the two.

I will also admit, though, that in many cases, I use my TO's much like a
VO, though I add more things like validation and related field
aggregation.  I generally use the same TO for input/modification as I do
for output/display.

For instance, I might have following TO:
<psuedocode/>
public class AccountTO {
Long accountId;
Long bankId;  // used primarily on input/modification methods such as
addAccount()
BankTO bankInfo;  // used primarily on output/display methods such as
getAccount()
}
In fact, I think this is one of the TO strategies.

Also,

These are the good reasons I can think of to use the exceptions (2,3,4)
(2) This might be needed if you have a TON of concurrent users updating
the same data, though your db and other controls might be able to handle
these issues.

(3)  Might be needed if your objects are HUGE and/or db access is slow.

(4)  Might be needed if there are a TON of db schema changes(that you
possibly don't have control over) and db access is slow.

Charles Bradley
Senior Java Consultant
Sun Certified Java Programmer (1.1, 2.0)

>
> Date:    Wed, 21 Apr 2004 19:04:29 +0930
> From:    James Telfer <jt@(protected)>
> Subject: Re: data update best practices
>
> Guy,
>
> The 4 methods I know of are:
>
> 1. All
> 2. Infer
> 3. Flag
> 4. Bag
>
> (1) is the simplest, as you've mentioned, but I must question whether this
> strategy will have the impact on performance that you suggest - I'd be
> interested to hear if any of the readers of the list can shed some light on
> this with empirical data. There are some situations (such as where change
> auditing at the database level is performed) where this isn't a great idea
> from other perspectives. For simplicity, though, this is so much easier -
> unless performance is /that/ much of a concern.
>
> (2) perform equality checks to infer if a change is required. This doesn't
> work well and is definitely not performant.
>
> (3) flags, as you mentioned, along the lines of what XDoclet generates. The
> only difficulties with this approach are more complex query generation (for
> BMP) and bean update logic. If the value object is not used by a Java client
> (if, say, it is serialised via CORBA and instantiated by a different
> platform) then you will have to make sure that the client application
> correctly sets the flags - something of a pain in the neck, particularly
> where code generation is involved.
>
> (4) is one I have no experience with, but you /could/, in theory, send a map
> containing only changed values back to the server. This may not reduce
> overhead all that much, but it may have some advantages for more dynamic
> views.
>
> This may not be much help - I can only suggest that you test your solution
> to see if it really does make a difference to performance (and if you do,
> please post your results :) ). I'm hoping that others will shoot me down if
> I'm way off beam.
>
> HTH,
> JT
>

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