1 Reply Latest reply on Mar 25, 2006 10:37 AM by Emmanuel Bernard

    The pk value from TableGenerator

    Ritchie Koh Newbie

      Dear

      I was using TableGenerator as below

      @TableGenerator(name = "IdGen",
       table = "ID_GENERATOR",
       pkColumnName = "ID_NO",
       pkColumnValue = "1",
       valueColumnName = "NEXT_VALUE",
       allocationSize = 1)
      


      and Pk field has the annotation as below
       @Id @GeneratedValue(strategy=GenerationType.TABLE, generator="IdGen")
      


      But there is unexpected value is inserted to the pk column as message

      15:49:59,203 DEBUG [SQL] select NEXT_VALUE from ID_GENERATOR where ID_NO = '1' for update
      15:49:59,531 DEBUG [AbstractBatcher] closing JDBC connection (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)
      15:49:59,609 DEBUG [Isolater] surrounding JTA transaction resumed [TransactionImpl:XidImpl[FormatId=257, GlobalId=RitchieKoh/14, BranchQual=, localId=14]]
      15:49:59,609 DEBUG [MultipleHiLoPerTableGenerator] new hi value: 1008
      15:49:59,609 DEBUG [AbstractSaveEventListener] generated identifier: 2016, using strategy: org.hibernate.id.MultipleHiLoPerTableGenerator

      Why did get the 2016 value instead of 1008
      Please let me know why?

      # Ritchie