-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Locking table with Transaction
PostPosted: Tue Aug 02, 2005 8:43 am 
Regular
Regular

Joined: Tue May 31, 2005 9:55 am
Posts: 67
I have a a one-to-many relationship between a Policy and Order

1 1..N
[Policy]----------[Order]

When I need to persist a new Order I must determine if a Policy objects already exists for the Order (based on policy number in Order). If it does not, I must create a new Policy and add the new Order to it. Otherwise, I must add the new Order to the existing Policy. How do I efficiently prevent creating a duplicate Policy if multiple concurrent Orders are being processing. Do I need to put a transaction around the entire operation? I only want to ensure that only 1 Policy gets created?

Thanks,
craig


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 19, 2005 10:00 am 
this is not a NHibernate Question, but I hope this help

you can create a synchronized class/object which the responsibility is to create Policy Object (search the word synchronization in .net or synchronized in java)

this is not the best way to do it.
tj


Top
  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.