Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

DB Interface implementation  RSS feed

 
anthony chan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,

In the DB interface that provided by the instruction. The explaination of method "lock" said "Locks a record so that it can only be updated or deleted by this client." Does the record mean one record in the data file or it means the data file. Since I know how to lock the data file, but I don't have any idea to lock one record inside the data file.

Thanks
anthony chan
 
Roel De Nijs
Sheriff
Posts: 11077
173
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Anthony,

I guess you should just lock that record, not the complete data file. So your program should deal with following sequence without any problems:

So while client1 holds the lock on record1, client2 is able to update the record on which it owns the lock.

Kind regards,
Roel
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!