Get your CodeRanch badge!*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes URLy1.2.1: versioning? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "URLy1.2.1: versioning?" Watch "URLy1.2.1: versioning?" New topic
Author

URLy1.2.1: versioning?

Tom Nicki
Greenhorn

Joined: Jun 21, 2006
Posts: 25
Hi all

I have a problem with database implementation.
As my DBAccess interface describes it should be done quite flexible.
I have following method:

// Modifies the fields of a record. The new value for field n
// appears in data[n]. Throws SecurityException
// if the record is locked with a cookie other than lockCookie.
public void updateRecord(long recNo, String[] data, long lockCookie)
throws RecordNotFoundException, SecurityException;

which - I guess - should allow to update whole record not only the last field where booking value (custormer id) is stored.

Here I fall into a problem.
- client A reads record 1 (info about hotel room in Paris)
- client B updates record 1 (now room is in London)
- client A updates record 1 (room booking)

Of course from my GUI reqirements this example does not make any sense.
Nobody whants me to change room location.

I just wish to implement databse layer in a flexible way.
Does it require to keep versions of all records on a server and client
side and match them while updating?
Where can I put that version number when provided database interface
does not include this information?

Is there any chance for flexibility here?

Thanks
Tom


SCJP1.4, applying for SCJD [URLy1.2.1]
Dinesh Mungra
Greenhorn

Joined: Jun 22, 2006
Posts: 7
Hi,

I have the other assignment, Bodgitt and Scarper, but they are analoguous I guess.
B&S is about booking contractors, not hotel rooms, but that does not matter. The assignment requires only that the user should be able to book a contractor, i.e. assign it a customer id. The location of the contractor will not change. I have assumed that changes to the contractor name, city etc will be done with another application, presumably not one of which there are multiple concurrent clients.
This is why I'm not planning to deal with this issue.
I am still working on my assignment and I don't know how it will be evaluated, but my plan is to allow updates of city etc in the server, but not implement them in the client.

I hope this helps,

Dinesh


***********************************<br />** **<br />** Dinesh Mungra, M.Sc. SCJP **<br />** **<br />** Read Watchmen. It's cool. ** <br />***********************************
Tom Nicki
Greenhorn

Joined: Jun 21, 2006
Posts: 25
Hi Dinesh,

It is nice to see somebody giving me a "ranch hand"

I understand you will take cake about checking if a record is booked
on the client side and your server provides function similar to:

It looks like your server provides full access to your database.
Teoretically any program (even not your client) can access your database and
change data via such an interface.

For sure it is flexible but from the other hand makes data your client
changes/books unreliable and this is why I created this topic on the forum.

Wouldn't be better to provide on the server:

instead of update(...)??

Positives:
- only server would know what booking means (for URLyBird
it would be updating 7th field in record)
- record cannot change (except booking/deleting) and for sure client
books what he sees on the screen.
- any program would be able to use this server without creating a mess
in database


Probably everything will be ok if described well in "General Considerations".

Tom
Mihai Radulescu
Ranch Hand

Joined: Sep 18, 2003
Posts: 916

Hi Tom


I have the same problem but I choose to isolate it on my back end(rod) layer.
Here I have a RecordChanger which encapsulate the "record changing algorithm" for URLyBird - set or reset the 7'th field.
In this way is easy to change the "booking algorithm" in the future.

I can atach my RecordChanger interface if you want it.

Regards, M


SCJP, SCJD, SCWCD, OCPJBCD
Tom Nicki
Greenhorn

Joined: Jun 21, 2006
Posts: 25
Hi Mihai,

I chosed the same solution.
Server offers: book(Room r, String customer)
This requires me to repack String[] to Room on the server side as well.
It simplifies also implementation of the client.

Maybe instead of interface for your RecordChanger you can tell me
how do you handle metadata problem.

Where do you store information that owner is 7th field in record
or hotelName is 1st etc.? This is my current problem.

Tom
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: URLy1.2.1: versioning?
 
Similar Threads
URLyBird - sending updates to the client
NX: URLyBird questions about database
Interface to Data
No definition of what is a DuplicateKeyException
NX:[URLyBird]How can I use the flexible way to implement RMI data access?