Unable to write/query attribute on type with AttributeConverter

Description

The model has java.time.YearMonth attributes being mapped to integers on the DB (MariaDB)

Here is how it was used:

And here is the converter class (based on Jakarta now):

Adding a demo project to the ticket with 2 errors:

  • Persisting the entity gives PersistenceException:

    • message: (conn=9) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'year_month, id) values (202212, 1)' at line 1

  • Searching the entity with MAX gives an IllegalArgumentException :

    • query: SELECT MAX(de.yearMonth) FROM DemoEntity de

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

Let me know if there is anything else that I can provide.

Attachments

1

Activity

Show:
Fixed

Details

Assignee

Reporter

Worked in

Fix versions

Affects versions

Priority

Created February 28, 2023 at 6:02 PM
Updated June 5, 2023 at 4:52 PM
Resolved March 30, 2023 at 4:11 PM