File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Can DB Interface be updated?! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Can DB Interface be updated?!" Watch "Can DB Interface be updated?!" New topic

Can DB Interface be updated?!

Dayanand Kangala

Joined: Sep 09, 2002
Posts: 26
My DBInterface has the following methods:
public String[] read(int recNo) throws RecordNotFoundException;
public int[] find(String[] criteria) throws RecordNotFoundException;

When a search is to be made based on a criteria, I can do the following:
(a) call the second method, retrieve all the record-nos that match the criteria
(b) use the first method to read all the matching records
If 10 records match the criteria, then 11 request (1 search + 10 request data) has to be sent to the server.
To reduce the network round-trip, I would like to introduce another method in the db interface. Has anyone changed the dbinterface before? and is it ok?
Introducing this method, might make the given methods in the DBInterface not
very useful ! is this ok?
The new method would return something like a "Value Object" design pattern.
Thomas Fly
Ranch Hand

Joined: Sep 09, 2002
Posts: 164
You can modify the Data class or extend it, as you wish (just say why you did one or the other).
In order to use RMI, the return object must implement Serializable, which most API objects (including arrays) do- so just return an array from your find method.

Fly by Night Consultants<br /> <blockquote><font size="1" face="Verdana, Arial">quote:</font><hr><i>I climbed on the back of a giant albatross<br />which flew through a crack in the cloud<br />to a place where happiness reigned...<br />all year 'round<br />the music played ever so loudly!</i><p><a href="" target="_blank" rel="nofollow">Hole in My Shoe</a><hr></blockquote>
I agree. Here's the link:
subject: Can DB Interface be updated?!
It's not a secret anymore!