I think that SUN does this with puropose - I mean to omit the primary key.
IMHO the primary key depends on your Data layer logic.
You can calculate/generate one using the record information and your Data logic.
By example (I have the URLyBird) on my case it make sense that a record apears two times in the database - because a hotel can have more than one room with the same attributes,
so I chose not to throw any DuplicateKeyException.
Try to handle it even if it is not possible by our code to throw it keeping in mind that other db solutions can use it.
Now that I think about it, my assignment does not mention giving clients the ability to add, modify, or delete rooms. It just mentions that the client must be able to search and assign a customer to an available room.
Well, I presume that the DBAccess is the interface(don't forget in interface the exception is throw) so this code fails by compiling because the Duplicate... is a checkable exception.
I don't use it exactly in this way but I still use createRecord method on a instance of type DBMain(DBAccess in your case).The method is in a try catch block.
Maybe we should swich to priv emails? I have doubts it is interesting for anybody except us.
Slideshow boring ... losing consciousness ... just gonna take a quick nap on this tiny ad ...
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koophttps://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton