1 Reply Latest reply on Apr 19, 2012 3:31 PM by Cdelahun-Oracle

    Knowing the Primary Key Sequence Generator of a table

      Hello All,

      I'm working on an application that uses Oracle toplinks/JPA for persistence. The entity classes in the application have primary key fields with annotations @Id and @GeneratedValue(strategy = GenerationType.AUTO). Per our understanding, this means the primary key generation is done by JPA/Top-links. When we see our database, we notice only one SEQUENCE table available and that table has only one row, while in the application, we are getting different sequence numbers for the primary key of each entity. So, not clear on how this sequence number is generated. Could anybody share information on where the sequence number is stored for each entity/table? Really appreciate your help here. Our database is MSSQL.

      Thank you,
        • 1. Re: Knowing the Primary Key Sequence Generator of a table
          EclipseLink/TopLink uses Table sequencing for GenerationType.AUTO because it is more portable between databases. My understanding of your issue is from
          Each row in the table represents one sequence generator, and your entities are all using the same default sequence generator and so all use the same row.

          To use multiple rows I believe you need to define multiple TableGenerators.

          Best Regards,