1

I am using DB2 GENERATED IDENTITY to auto-increment value for a column. The column is not a primary key column. I am not sure how to configure the field in the hibernate mapping class. Please help.

coms
  • 469
  • 15
  • 38
l a s
  • 3,836
  • 10
  • 42
  • 61

1 Answers1

1

Use the @Generated annotation, and make sure to mark the property as non insertable, adn non updatable, as explained in the Hibernate documentation.

Note that this will force Hibernate to issue an additional select query after each insert and update query.

JB Nizet
  • 678,734
  • 91
  • 1,224
  • 1,255