Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-296

UUID algorithm generating non-unique values sometimes

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.9.0, 0.9.6, 0.9.7
    • 1.0.0
    • sql
    • None

    Description

      From the dev list:

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

      Attachments

        Activity

          People

            Unassigned Unassigned
            pcl Patrick Linskey
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: