Meaningless Drivel is fun!*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes B&S question about new values in updateRecord Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "B&S question about new values in updateRecord" Watch "B&S question about new values in updateRecord" New topic
Author

B&S question about new values in updateRecord

Steve Taiwan
Ranch Hand

Joined: Jul 01, 2003
Posts: 166
I assume, in updateRecord(long recNo, String[] data, long lockCookie),
String [] data contains only new values and no old values.
am I correct?

ex: If I want to update name of recNo 1, then in String[] data,
the data structure should be like data[0]="new name", data[1]="", data[2]="", data[3]=""
........am I right??



Steve Taiwan<br />SCJP 1.2, SCJD 1.4, SCWCD 1.3, SCBCD 1.3, OCP 8i DBA, SCEA
Jared Chapman
Ranch Hand

Joined: Feb 23, 2004
Posts: 81
Hi Steve,

Good question.

I do not think you should use "" as an indication that a field should not be updated. What would happen if you wanted to intentionally delete a field?

This is how I have handled it so far:

This allows me to update a record in one of two ways:
1. String[] newData = {"new name", "old location", ..., "old owner"};
OR
2. String[] newData = {"new name", null, null, null, null, null};

And as always, it will be well documented.


B.S. University of Wisconsin<br />SCJP 1.4 (85%)<br />SCJD 1.4 (92%) B&S Contractors
Steve Taiwan
Ranch Hand

Joined: Jul 01, 2003
Posts: 166
Thank you for the reply.
Greate solution.
I redesigned and changed my code according to your suggestion.
Thanks again.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: B&S question about new values in updateRecord
 
Similar Threads
B&S 2.2.2 updateRecord()
question about the update
Difference b/w Cookie and LockCookie
Is checking for SecurityException in updateRecord method necessary?
Can I use another db file for optimistic locking?