Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

Sure Vat

Greenhorn
+ Follow
since Mar 25, 2003
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Sure Vat

Which is the best aproach to create a class -Constructor or Static Factory ? check out http://goo.gl/KgpU2
8 years ago
yep that will help..
also have a look at hibernate.org

Television
13 years ago
JSF
DT
I think the problem is with the class path only. I think u have to go back and refresh the basics of classpath, as it is one of the fundamental thing to know.
U specified the classpath as "c:\mydir\suncertify\db". That means JVM will look for a directory structure - suncertify/db/FieldInfo class under "c:\mydir\suncertify\db" directory, which is not the case. So your classpath must be "c:\mydir\"

I gave the command line argument as
c:\mydir\suncertify\db>javac DataInfo.java
and I gave class path as
set classpath=c:\mydir\suncertify\db
Did I do anything wrong?
By the way I am a florist.
I think it is a design issue. You could easily get rid of this problem by having two classes, one for remote and other for local, derived from an abstract base class. Then for catching the exception from both cases, you could define a user defined exception, which will be thrown in both cases.
I am sure what i have specified here is a broad idea rather than a precise one to the point. But i hope you got the point.
The problem here is very simple but made complicated due to confusion. I think most of the people have got the right opinion, but it become unclear due to the way of presentation. I am here trying to put all your comments in order 
Initial question was - the method modify() is synchronized, but why we need a locking mechanism? A reply to it was to separate the business logic from the utility layer. {consider suncertify.db package as an utility package, used across many application}.
The person, who raises this doubt, was considering only the present minimum requirement, but as per the requirements, a generic solution is expected.
For better understanding, assume that the requirement is like this.
[1] For all airlines, except "SpeedyAir" , it must work as per the requirement specified in the instruction. That is if there is one seat remaining and two people try to book simultaneously, only one should be allowed to book and the second must be notified about the non-availability.
[2] For "SpeedyAir" reservation, along with above requirement, there is an additional condition - passenger must be above 18 years of age. {This is an additional requirement from my side, for a better explanation}
Considering this as the requirement, it is not wise to code all these logic in the modify() method, though purpose can be met. So here the approach of design must be based on following facts..
[a] Business rules can change frequently and system must be easily tuned with the new requirements
[b] Reusability of classes { suncertify.db package usuage across applications}
So considering the facts, we have to design as follows.
Make the suncertify.db package very generic
Provide a business class to handle the business rules, say a class suncertify.flight.Reservation
When users try to reserve the seat, the request will be handed over to the Reservation class. It will check whether the request can be fulfilled. If so it will request for the service of the db package through the lock call. If the locking went successful, it will check for the seatavailability. If seats are available, the Reservation class will book a seat else throw an exception {say ReservationException}. At the end the business class will release the lock
By doing so, the suncertify.db package will become very generic and it can be used for database operations across various projects.
This is exactly what SUN try to convey, by coming up with the lock() & unlock() requirement. This requirement made us all to think and debate about its necessity and we learned a lot about good design approach. This is the best part in SCJD.
So enjoy