Could somebody explain why InheritanceType.TABLE_PER_CLASS could not use the GenerationType.AUTO strategy for primary key value generation when mapping inheritance?
JPA: Why GenerationType.AUTO could not be used with InheritanceType.TABLE_PER_CLASS strategy
GenerationType.AUTO is used when the db table has its own auto generation of ids e.g. AUTO_INCREMENT . This may not work in the the TABLE_PER_CLASS scenario as you would have collisions between each of the independently generated ids and so could not guarantee a unique id for any entity instance within the hierarchy –
Renita
© 2022 - 2024 — McMap. All rights reserved.