Reputation: 362
My question is, why do we need a sequence table for table strategy in hibernate inheritance, which id generation must be equal to TABLE? Can't each entity use the IDENTITY column of each table?
@Id
@GeneratedValue(strategy = GenerationType.TABLE)
@Column(updatable = false, nullable = false, insertable = false)
protected int id;
Upvotes: 0
Views: 58
Reputation: 101
As for the jakarta.persistence.GenerationType
javadoc, TABLE
is used to indicate the primary keys should be stored in an underlying database table - which is separate from the entities tables - whether you are using inheritance or not.
If you want id
to be an IDENTITY
column for each table you should use the GenerationType.IDENTITY
strategy.
Upvotes: 1