This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes (B&S)Performing Bookings Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "(B&S)Performing Bookings" Watch "(B&S)Performing Bookings" New topic
Author

(B&S)Performing Bookings

Saheed Adepoju
Ranch Hand

Joined: Jun 23, 2004
Posts: 267
Hi all
I have been off for a while, my computer crashed, i recovered my assignment source codes(thanks to my linux O/S). I have been busy soiling my hands with .NET due to the projects here at the office, but i guess i had finish this thing before i get overloaded with work. My question is how to perform the actual bookings in the database. Does the user enter the customer id and then use the update method?If that is so, do I just change the code to only write the customer id instead of updating a whole record?Anyways,i look forward to your insights!


Saheed Adepoju<br />SCJP 1.4<br />SCJD (B&S..In progress)
Oricio Ocle
Ranch Hand

Joined: Nov 30, 2004
Posts: 284

Hello Saheed, welcome back
Does the user enter the customer id and then use the update method?

That depends on your personal implementation.

In a 3-tier scenario you'll book through you'r business method book(recNo,customerID). This business methods should delegate to data methods, i mean data class should not implement business methods, in order to have responsibilities well defined.

If you are exposing data methods to the client then it's client responsibility knowing the business rules, so it must deal with the data update method.

then so you are on the 2-tier side:
If that is so, do I just change the code to only write the customer id instead of updating a whole record


Altering update method functionality in such way will surely lead you to an automatic failure.

If interface methods do not do your stuff, add more functionality to your class, but never modify them or their expected implementation. Think that the provided interface is the target of their first automatic tests.

Hope that helps you,
Regards


SCJP, OCMJD, OCMJEA
Saheed Adepoju
Ranch Hand

Joined: Jun 23, 2004
Posts: 267
Hi
Cool! Anyways, i have a business method that contains a Book() method and it accepts a record number and a customer id.So i am using a 3 tier approach! So this is what i assume will happen whenever i book a record. A user clicks within JTable and when the user clicks book(after entering the customer id), the whole record is sent to the update() method. Using the whole information in each cell of the JTable and also the customer id, an array of strings is then passed to the update method. Is this a good approach to the update() thanks!
Oricio Ocle
Ranch Hand

Joined: Nov 30, 2004
Posts: 284

Hello again Saheed,
your words makes me think that it's not really a 3-tier approach...
... the whole record is sent to the update() method. Using the whole information in each cell of the JTable and also the customer id

In a 3-tier approach business layer is serverside. So the only information that must travel is the record number and the customer ID, ie the book method arguments.
Then your book method could use data methods:
-read: for getting all field information
-update: for update new field information from that and the customer id...

Regards, Ori
Saheed Adepoju
Ranch Hand

Joined: Jun 23, 2004
Posts: 267
Hi
Sorry for the confusion. The client actually calls the business method Book(). and then within the book(): calls to read and update is then made. Then i pass an array of strings(read from the read() method within the Book) and then an update is then done with the customer id). I do this is in line with a valid Book(). Your insight will be highly appreciated. .
Leo Ho
Ranch Hand

Joined: Mar 31, 2005
Posts: 36
You may need a lock(), before read() and update() are called.

Leo
Leo Ho
Ranch Hand

Joined: Mar 31, 2005
Posts: 36
You may need a lock(), before read() and update() are called.

Leo
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: (B&S)Performing Bookings
 
Similar Threads
Thanks for all guys!
NX contractor : Booking a record
[URLyBird 1.3.1] Just download, some questions!
The solution of usage efficiency of room, please talk about it.
B&S: Owner ID