Reputation: 342
PanacheEntity defaults ID type to Long. Distributed database like Spanner prefers UUID. How to override/change the default type?
Upvotes: 2
Views: 3771
Reputation: 64011
You don't necessarily need to extends from PanacheEntity, you can just as well use PanacheEntityBase and provide your own ID.
Upvotes: 6
Reputation: 41
Couldn't place a comment, The solution @geoand provided is the intended solution as stated https://quarkus.io/guides/hibernate-orm-panache#custom-ids
IDs are often a touchy subject, and not everyone’s up for letting them handled by the framework, once again we have you covered.
You can specify your own ID strategy by extending PanacheEntityBase instead of PanacheEntity. Then you just declare whatever ID you want as a public field:
Upvotes: 1