| 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
 
 
 |