Branch: refs/heads/main
Home:
https://github.com/hibernate/hibernate-orm
Commit: f8e4e6e49f5b85b719633a8f55193c0f4ae4e608
https://github.com/hibernate/hibernate-orm/commit/f8e4e6e49f5b85b719633a8...
Author: Luca Molteni <volothamp(a)gmail.com>
Date: 2024-09-30 (Mon, 30 Sep 2024)
Changed paths:
M hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java
M
hibernate-core/src/main/java/org/hibernate/dialect/OracleUserDefinedTypeExporter.java
A hibernate-core/src/main/java/org/hibernate/dialect/function/OrdinalFunction.java
M
hibernate-core/src/main/java/org/hibernate/query/sqm/produce/function/ArgumentTypesValidator.java
M
hibernate-core/src/main/java/org/hibernate/query/sqm/produce/function/FunctionParameterType.java
A hibernate-core/src/test/java/org/hibernate/orm/test/hql/EnumTest.java
Log Message:
-----------
HHH-16861 HQL ordinal() function
The `ordinal` function returns the `ordinal` property of Java enums, for both enums mapped
as ORDINAL and enums mapped as STRING generating different SQL in each case
`ordinal(field)` is equivalent to `cast(enum as Integer)`, implementation taken from
CastStrEmulation when used on ordinal mapped enums.
Lexer and parser don't need to be changed as there is nakedIdentifier that matches
custom function names
`ordinal` function is validated to work only on Java enum fields
Use convertToRelationalValue to generate enum value inside the SQL query
Co-authored-by: Christian Beikov <christian.beikov(a)gmail.com>
To unsubscribe from these emails, change your notification settings at
https://github.com/hibernate/hibernate-orm/settings/notifications