This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
As a South African who grew up in the townships, I've been finding it extremely hard to learn Java on my own, with no peers around to bounce ideas with. Thanks to the forums like this, my job is getting easier every day, so big THANK YOUs to the guys behind these forums!
I'm implementing UrlyBird Ver 1.1.2. The one glaring thing is the lack of the primary key in the schema. It appears the schema should have had the "Number of Available Rooms" field. It's as if the assumption is "on any given day and price, any hotel can only have one room of its kind". Is that a safe assumption?
Sihle, comrade; we all make that question when we have to implement the data interface provided by Sun Microsystems.
I have read throughout this forum different approaches about how to implement primary keys.
My approach is not to implement it. Although the interface declares a DuplicateKeyException, my implementation (Data.java as required by the documentation) does not throw any exception on creating a new record.
From the Java language point of view is valid that an implementation of class do not necessarily throw the exceptions declared in the method signature of the interface.
Now, if I had to implement a primary key, I would do it with primary key based in all the fields, which is the only logical decision I could take regarding this matter.
But, the decision would complicate also the updateRecord method, since now, an update could violate the primary key.
Surprisingly, the updateRecord method does not declare this exception.
PS I hope you local community of Java Developers continue to increase and I wish you a lot of success with your SCJD! [ October 03, 2006: Message edited by: Edwin Dalorzo ]