Thread:
 Possible "Race" condition in db-query for uniquene... 
 eepstein   16 Mar 2004, 22:45 

Comment
Prev. thread 
 Next thread
 
Prev. posting 
 Next posting
From: eepstein (16 Mar 2004, 22:45) Replies: 0, Views: 40840
Subject: Possible "Race" condition in db-query for uniqueness
Of course if you do use a separate query to guarantee uniqueness then 
you need a transaction that is spanning the queries.  Otherwise in a 
pseudo-race condition this will not ensure uniqueness.  E.g.,

a) check name "foo" is unique --> result = true
b) insert record with name "foo"
a) insert record with name "foo" --> fails!
Prev. thread 
 Next thread
 
Prev. posting 
 Next posting
© Copyright 2006, Red Hat Middleware, LLC. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc. [Privacy Policy]