openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Prud'hommeaux <mprud...@apache.org>
Subject Re: uuid-string not generating unique ids
Date Wed, 25 Jul 2007 17:11:09 GMT
Patrick-

I bet you are right. Your analysis of the problem looks correct to me.


On Jul 25, 2007, at 9:12 AM, Patrick Linskey wrote:

> Hi,
>
> Based on a quick read, it looks like maybe the problem is
> UUIDGenerator.java:178. I suspect that we should be changing that to
> obtain another newTime inside the if block after incrementing the
> sequence. However, I'm not an expert in this algorithm; does anyone
> have a better grasp on it than do I?
>
> -Patrick
>
> On 7/25/07, Elias Torres <elias@torrez.us> wrote:
>>
>> Hi,
>>
>> First off, I want to say thank you for the hard work this  
>> community has
>> put on this JPA implementation. I'm extremely eager in getting to  
>> know
>> it better and hopefully put it to good use in some of the projects  
>> I'm
>> currently working on at IBM. If all goes well, I'll be asking some of
>> the harder questions later and possibly discuss new features not
>> currently implemented.
>>
>> Now if you could please help me out with a small issue I'm having  
>> with
>> uuid generation.
>>
>> @Entity
>> public class Foo {
>>
>>   @Id
>>   @GeneratedValue(strategy=GenerationType.AUTO, generator="uuid- 
>> string")
>>   private String id;
>>
>> }
>>
>> CREATE TABLE Foo (
>>   id VARCHAR(16) NOT NULL
>> }
>>
>> If I do one em.persist() it works just fine. However, if I do a a  
>> whole
>> list of them, I get exceptions (duplicate). If I enable logging I can
>> see they are all using the same id during INSERT. I stepped a bit
>> through the code and noticed that uuid-string doesn't get generated
>> while em.persist(), but much later while committing/flushing. I then
>> looked a bit (just a bit) at the UUID generator code and noticed that
>> the bytes are not changing much (maybe only the first two), but  
>> again,
>> that was while debugging, so I'm assuming I have a supa-fast machine.
>>
>> Anybody running into the same problem? Any suggestions?
>>
>> -Elias
>>
>
>
> -- 
> Patrick Linskey
> 202 669 5907


Mime
View raw message