• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hibernate Scanario based question

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi to all,

I’ve the scenario based Hibernate question.

There is 1 person name “Sony” with age 25. Admin A will get requirement to update his age from 25 to 21. He’ll fetch the details from DB & by this time he’ll not update, at the same he’ll get call & he’ll leave the place
Now other admin B will come he too wants to update Sony’s age from 25 to 30. So he’ll fetch the date from DB & updates it.
Now the admin A will come & updates Sony’s age from 25 to 21.

Now my questions are that
1. Can admin A update Sony’s age?
2. If yes is it the correct way?
3. If it is not correct way then how to avoid this?

Waiting fir your reply.
Thanks & Regards,
Geeta

 
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi geeta,

I think what you need is an optimistic lock on your person Object.
here is an article that tells you how you can apply optimistic lock on your bean.

 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This can also be done using annotations. See the reference guide:

http://docs.jboss.org/hibernate/orm/4.1/devguide/en-US/html_single/#d5e1108
 
Geeta Puttappanavar
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hemant Thard wrote:Hi geeta,

I think what you need is an optimistic lock on your person Object.
here is an article that tells you how you can apply optimistic lock on your bean.



Thank you so much. I got it..
 
Geeta Puttappanavar
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bill Gorder wrote:This can also be done using annotations. See the reference guide:

http://docs.jboss.org/hibernate/orm/4.1/devguide/en-US/html_single/#d5e1108



Thanks Bill. I try the example..
 
Geeta Puttappanavar
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Geeta Puttappanavar wrote:

Hemant Thard wrote:Hi geeta,

I think what you need is an optimistic lock on your person Object.
here is an article that tells you how you can apply optimistic lock on your bean.



Thank you so much. I got it..



Hi Hemanth,

Can you please explain that how the optimistic lock will happen in the above example??

Thanks,
Geeta
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic