Michał Maliszewski ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5ad7619... ) *commented* on HHH-16859 ( https://hibernate.atlassian.net/browse/HHH-16859?atlOrigin=eyJpIjoiM2NhMz... )
Re: max() doesn't work with Enums ( https://hibernate.atlassian.net/browse/HHH-16859?atlOrigin=eyJpIjoiM2NhMz... )
>
>
>
> (…) if you map them with @Enumerated(STRING) , which is the mapping I think
> is strongly preferable.
>
>
I would not agree that the String type of enum is strongly preferred. Whenever there is a need for high performance or the size of the stored data is important then ordinals are preferred over string representation.
I take the point that it does not make sense when the enum is stored as a String:
@Column(name = "SOME_ENUM" )
@Enumerated(EnumType.STRING)
private ESomeEnum type;
but here again is a question about consistency:
enum = int // legal
enum = enum // also legal, no matter if stored as a STRING or ORDINAL.
>
>
>
> And, for the record, we’re totally within our rights to make deliberate
> changes like this in a major version
>
>
Of course you have right to do any incompatible changes between major versions. You can even not write anything in the manuals or other documentation, but that doesn’t make Hibernate any better. There will be large projects migration soon, and you will have to face those if you decide to not take any actions. There is plenty of use cases where even:
enum > 1
makes a lot of sense (simplest case: where every version is a single enum value and you want collect all data with version > x).
>
>
>
> I frankly don’t even know what the big deal is when there’s a rather
> trivial and perfectly natural workaround: max(cast(enum as Integer)).
>
>
The problem is not about the workaround, the real effort is to change the APIs that expects enum from the query as it was previously possible for 5.x series. It makes it even worse that Hibernate does not throw the exception as long as you don’t use the query. For the large projects it might be quite some effort.
( https://hibernate.atlassian.net/browse/HHH-16859#add-comment?atlOrigin=ey... ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-16859#add-comment?atlOrigin=ey... )
Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.... ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100227- sha1:534ec1c )