Uploaded image for project: 'EJB 3.0'
  1. EJB 3.0
  2. EJBTHREE-597

javax.persistence.SequenceGenerator mapped to "seqhilo" and not "sequence" by org.hibernate.cfg.AnnotationBinder

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Major
    • None
    • EJB 3.0 RC7 - FD
    • None
    • None

    Description

      @javax.persistence.SequenceGenerator(name = "Question_id_sequence", sequenceName = "S_QUESTION")

      is mapped to a "seqhilo" generator by org.hibernate.cfg.AnnotationBinder (line 332) which causes strange ids to be generated. These ids appear to have no relation to the actual sequence state, even though "select S_QUESTION.nextVal from dual" is generated by Hibernate through JDBC. The ids start at 50 for an intial deployment, 150 after a redeployment, then 250 for the following deployment, etc, etc.

      If stored procedures are used which use the S_QUESTION sequence to insert rows into the same table then a conflict will happen sometime in the future, since Hibernate does not use the value from the sequence.

      If I replace the above @javax.persistence.SequenceGenerator definition with:

      @org.hibernate.annotations.GenericGenerator(name="Question_id_sequence", strategy = "sequence",
      parameters =

      { @Parameter(name="sequence", value="S_QUESTION") }

      )

      the actual S_QUESTION.nextVal value is used correctly by Hibernate.

      Attachments

        Activity

          People

            rhn-engineering-ebernard Emmanuel Bernard
            djr667_jira David Richmond (Inactive)
            Votes:
            5 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: