Unable to use SQL functions on UserType attribute

Description

Similar to , but concerns querying when type conversion is done using UserType.

Given an attribute:

and UserType:

it’s impossible to eg. SELECT max(yearMonth), because query creation fails with:

java.lang.IllegalArgumentException: org.hibernate.QueryException: Parameter 1 of function max() has type COMPARABLE, but argument is of type java.time.YearMonth

Attached test case was made as a copy of , but uses @Type instead of AttributeConverter.

@JavaType also doesn’t work (test case in JavaType.zip, copied from ).

Attachments

2

Activity

Show:

Marco Belladelli August 2, 2023 at 11:59 AM

This was already fixed in 6.3 by the changes related to . Version 6.3.0.CR1 has already been released and should correctly handle the cases reported in this issue.

I’m going to close this, feel free to add any comments or open a new issue if any problems with functions and user types persist.

Edwin Volz July 31, 2023 at 1:06 AM

It would be very important to fix the problem. Currently usertypes cannot be used with Hibernate 6.

Timon Zilles June 27, 2023 at 1:26 PM
Edited

+1

I have a similar problem which I have described on StackOverflow (but here I use a criteria query):

This contains also reproducer projects (with Quarkus).

For us this is a blocker!

Fixed

Details

Assignee

Reporter

Worked in

Components

Fix versions

Affects versions

Priority

Created June 5, 2023 at 4:42 PM
Updated August 2, 2023 at 11:59 AM
Resolved August 2, 2023 at 11:59 AM