|
From: Isabelle M. <isa...@me...> - 2003-04-20 05:42:13
|
Hi Dmitryi, I'm incorporating your code into Spring, and am just now looking at RdbmsMaxValueIncrementer. I feel pretty uneasy about this code, as I think it could lead to duplicate values of the key being handed out. This because the actions of selecting and writing out the new value are separate. Consider this : (1) the current max value is 5 (2) connection 1 does select (max+1) and receives 6 (3) connection 1 goes off and does some work with the value 6 in mind (4) connection 2 does select (max+1) and receives 6 (5) connection 1 commits, this is ok (6) connection 2 commits and gets a duplicate key exception I understand your rationale for the code -- after all, what does one do with some unknown database -- but I think we should comment the code as being potentially unsafe. Isabelle -- Isabelle Muszynski Software Engineer Zandweellaan 4 2660 Antwerpen Belgium Tel. 32-(0)3-830 18 54 Mobile: 32-(0)485 49 50 89 Email: isa...@me... Website: www.meta-logix.com |