hibernate_sequence considered harmful #3809
Replies: 3 comments 19 replies
-
To be clear... you are talking about just the name, right? I bring this up because on the source issue in Quarkus there seemed to be some suggestions that we change the strategy that AUTO maps to, which I completely disagree with. What you want is to change the strategy for changing the implicit name of the database structure backing the SequenceStyleGenerator, similar to What I would suggest is this... Take these settings I mentioned and extract them into a strategy ( Or maybe even a method on You sometimes like to scoff at backwards compatibility, and I am uber jealous that we cannot do that in ORM; but we can't - we have to consider backwards compatibility. We all agree the name sucks, but it has unfortunately sucked for the last 20 years. Whatever choice we make here needs to not break that. Actually I think the existing settings may even be fine for your needs. The problem with extending that to your needs is that atm they are specific to each generator. We could look at a cascade setting: local > global. But that would give Quarkus, Panache and users the ability to control that for the whole SF (aside from local overrides). So a few nice options I think. And yes, I think we should finally change this in 6 |
Beta Was this translation helpful? Give feedback.
-
So it seems the situation here is better than I thought. I had thought that Nevertheless, after sleeping on this, I still think that a sequence-per-hierarchy would be preferable to a single global sequence with a weird name. And I would still prefer to change it to work like that (by default) in H6. WDYT, @sebersole? |
Beta Was this translation helpful? Give feedback.
-
On databases which prefer sequence id generation,
GenerationType.AUTO
defaults to use of a single sequence with the namehibernate_sequence
.This is bad for two reasons:
hibernate_sequence
in their database, andNow, I need to do some more reading, but IMO,
GenerationType.AUTO
doesn't have any really well-defined semantics in JPA, and we can legitimately change its behavior to create a sequence based on the corresponding table name.And I think we should do this in H6.
Beta Was this translation helpful? Give feedback.
All reactions