• 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

@PrePersist Synchronizing

 
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 ,
iam using JPA with Hiberante provider , How can i ensure that @PrePersist and the "Peristing" process to be executed in synchronized mode , i mean i don't wont other thread to execute @PrePersist before the previous one has already saved into DB , is this supported By JPA by default or is there any extras i should do , Thanks
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure about synchronization here, but do you know about ThreadLocal. Please check the following : http://www.hibernate.org/hib_docs/entitymanager/reference/en/html_single/#transactions-basics-uow
 
Mohammad Jaber
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 ,
Iam already using ThreadLocal but my case is that i want to fetch the Id (Max + 1) from the DB during the PrePersist and i want to make sure that no other thread will intrupt this by fetching the same value from the DB , Thanks
reply
    Bookmark Topic Watch Topic
  • New Topic