Reputation: 1195
While using the JPA tablegeneration strategy , we need to mention the allocation size in the @TableGenerator. The default value is 50. We want to override the default allocation size.
But the allocation size needs to be mentioned in every entity. Is there any other better way of doing this ( like configuring it globally or by configuring it as an additional column in the table used for tracking generated Ids )
Upvotes: 0
Views: 193
Reputation: 1195
I found a workaround using hibernate @genericgenerator. we can override the allocation size by fetching it from table and then reconfiguring the idgenerator
Upvotes: 0
Reputation: 94499
Using Plain JPA this does not seem to be possible as noted in these posts:
Setting default allocation size for all entities?
How do I configure allocationSize within persistence.xml instead of Entity
It appears that the EclipseLink
JPA implementation does provide you with the ability to set this element globally with the `SessionCustomizer'
Upvotes: 1