JPA: Why GenerationType.AUTO could not be used with InheritanceType.TABLE_PER_CLASS strategy
Asked Answered
L

0

6

Could somebody explain why InheritanceType.TABLE_PER_CLASS could not use the GenerationType.AUTO strategy for primary key value generation when mapping inheritance?

Longdistance answered 7/6, 2014 at 6:51 Comment(1)
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 hierarchyRenita

© 2022 - 2024 — McMap. All rights reserved.