You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because UserType does not extend the Hibernate Type contract, we cannot provide a custom Type for a scalar result in a native SQL query as in the following example:
List<Tuple> tuples = entityManager
.createNativeQuery(
"SELECT " +
" id, " +
" account_id, " +
" created_on - FIRST_VALUE(created_on) OVER ( " +
" PARTITION BY account_id " +
" ORDER BY created_on " +
" RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING " +
" ) AS since_first_transaction, " +
" LAST_VALUE(created_on) OVER ( " +
" PARTITION BY account_id " +
" ORDER BY created_on " +
" RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING " +
" ) - created_on AS until_last_transaction " +
"FROM account_transaction " +
"ORDER BY id", Tuple.class)
.unwrap(org.hibernate.query.NativeQuery.class)
.addScalar("since_first_transaction", PostgreSQLIntervalType.INSTANCE)
.getResultList();
The easiest way to fix this is to make the ImmutableType implement the Type contract as well.
This way, we can deal with the No Dialect mapping for JDBC type at the SQL query level, no matter if the associated type implements the Hibernate org.hibernate.type.Type or org.hibernate.usertype.UserType.
The text was updated successfully, but these errors were encountered:
The method addScalar(String, BasicTypeReference) in the type NativeQuery is not applicable for the arguments (String, PostgreSQLPeriodType)
or
java.lang.ClassCastException: class io.hypersistence.utils.hibernate.type.interval.PostgreSQLPeriodType cannot be cast to class org.hibernate.metamodel.model.domain.BasicDomainType (io.hypersistence.utils.hibernate.type.interval.PostgreSQLPeriodType and org.hibernate.metamodel.model.domain.BasicDomainType are in unnamed module of loader com.ibm.ws.classloading.internal.AppClassLoader @656f8f18)
Because
UserType
does not extend the HibernateType
contract, we cannot provide a custom Type for a scalar result in a native SQL query as in the following example:The easiest way to fix this is to make the
ImmutableType
implement theType
contract as well.This way, we can deal with the
No Dialect mapping for JDBC type
at the SQL query level, no matter if the associated type implements the Hibernateorg.hibernate.type.Type
ororg.hibernate.usertype.UserType
.The text was updated successfully, but these errors were encountered: