Deprecate ZoneIdType for Hibernate 6
reitzmichnicht opened this issue · 3 comments
After searching if ZoneId is supported by Hibernate I had the estimation that its not supported because this great library adds special support for it.
After trying out plain Hibernate 6.4 we were surprised that in the meantime hibernate itself has added support for it, supposedly by 6.0
hibernate/hibernate-orm@37bc00e#diff-d8c39eb8d53e8873449c3bbf841d941f2258f44edd134bae5347453ff7a6ef3d
So I guess it would be beneficial to remove duplicate support for those types for the 6.x versions of this lib.
There is the option of using the Hibernate @JavaType(ZoneIdJavaType.class)
, but if you change that in the ZoneIdTest
, it will break in the 63 module with this error:
org.hibernate.HibernateException: Could not convert 'java.time.ZoneRegion' to 'java.time.ZoneId' using 'org.hibernate.type.descriptor.java.ZoneIdJavaType' to wrap
at org.hibernate.type.descriptor.java.JavaTypeHelper.unknownWrap(JavaTypeHelper.java:28)
at org.hibernate.type.descriptor.java.AbstractClassJavaType.unknownWrap(AbstractClassJavaType.java:116)
at org.hibernate.type.descriptor.java.ZoneIdJavaType.wrap(ZoneIdJavaType.java:68)
at org.hibernate.type.descriptor.java.ZoneIdJavaType.wrap(ZoneIdJavaType.java:19)
at org.hibernate.sql.exec.spi.JdbcParameterBindings.registerParametersForEachJdbcValue(JdbcParameterBindings.java:80)
at org.hibernate.sql.exec.spi.JdbcParameterBindings.registerParametersForEachJdbcValue(JdbcParameterBindings.java:69)
at org.hibernate.query.sqm.internal.SqmUtil.createValueBindings(SqmUtil.java:468)
at org.hibernate.query.sqm.internal.SqmUtil.createJdbcParameterBindings(SqmUtil.java:397)
at org.hibernate.query.sqm.internal.ConcreteSqmSelectQueryPlan.buildCacheableSqmInterpretation(ConcreteSqmSelectQueryPlan.java:413)
at org.hibernate.query.sqm.internal.ConcreteSqmSelectQueryPlan.withCacheableSqmInterpretation(ConcreteSqmSelectQueryPlan.java:324)
at org.hibernate.query.sqm.internal.ConcreteSqmSelectQueryPlan.performList(ConcreteSqmSelectQueryPlan.java:300)
at org.hibernate.query.sqm.internal.QuerySqmImpl.doList(QuerySqmImpl.java:509)
at org.hibernate.query.spi.AbstractSelectionQuery.list(AbstractSelectionQuery.java:427)
at org.hibernate.query.spi.AbstractSelectionQuery.getSingleResult(AbstractSelectionQuery.java:564)
at io.hypersistence.utils.hibernate.type.basic.ZoneIdTest.lambda$test$2(ZoneIdTest.java:54)
at io.hypersistence.utils.test.AbstractHibernateTest.doInJPA(AbstractHibernateTest.java:491)
at io.hypersistence.utils.hibernate.type.basic.ZoneIdTest.test(ZoneIdTest.java:46)
Thats strange, I played around a little bit with your test. The entity itself works, but HQL query does not work. Looks like this is a bug in Hibernate maybe.
Sorry for being too optimistic about this.
Yes, it looks like the ZoneId
cannot work as a ZoneRegion
with the default Hibernate Type.