openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Elias Torres <el...@torrez.us>
Subject uuid-string not generating unique ids
Date Wed, 25 Jul 2007 14:12:07 GMT

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

Mime
View raw message