• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can DB Interface be updated?!

 
Dayanand Kangala
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
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.
Dayanand.
 
Thomas Fly
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic