Migrating from Hibernate 5 to Hibernate 6 I got an exception. The Entity User maps a a converted attribute year.
@Entity
public class User {
..
@Convert(converter = YearConverter.class)
public Year year;
..
}
Querying the entity using the attribute via
var query = em.createQuery(
"from User u " +
"where :year is null or u.year=:year",
User.class);
query.setParameter("year", Year.from(2022));
var entity = query.getSingleResult();
leads to
I created a minimal example project. |