This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Confounding Interview Question Regarding Hibernate

 
Arijit De
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was asked the following question at an interview a few days back.

There is a table <EmployeeNo, Salary>. There is an entry ('Emp1', $100).
User A updates the tuple altering salary from $100 to $200.

Later another user B tries to update tuple from $100 to $400.

How can you prevent this?

There is a special feature in hibernate to prevent this doube update. What is it?


I said that if the two users are concurrently trying to update the tuple, then doing updates within a simple transaction would prevent a dirty read.
However, this was not the answer as users A and B were not concurrently updating.

Does anyone have an answer?



 
Hemant Thard
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Arijit,

Welcome to Java Ranch.


To answer your question, i would suggest you to take a look at this example .

 
Arijit De
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hemant, Thanks. I guess I had not used versioning.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic