I have below query
@Query(value="SELECT " +
"NEEDARRIVDATE AS needArrivDate, " +
"SCHEDARRIVDATE AS schedArrivDate," +
"FROM ARRIVETABLE " +
"WHERE " +
"TO_DATE(CONVERT_TIMEZONE('UTC', 'UTC', NEEDARRIVDATE)) > TO_DATE(:date) ",
nativeQuery = true
)
DetailsProjection getDetails( @Param("date") Instant date);
For projection
public interface DetailsProjection {
Instant getNeedArrivDate();
Instant getSchedArrivDate();
}
Which is giving Caused by: org.hibernate.MappingException: No Dialect mapping for JDBC type: 2014
Where as this columns are mapped to instant using entity. It is working for Entity but not for Projection.
Surprisingly, it is working if I use the conversions in the query.
@Query(value="SELECT " +
"CONVERT_TIMEZONE('UTC','UTC',NEEDARRIVDATE) AS needArrivDate, " +
"TO_TIMESTAMP_NTZ(CONVERT_TIMEZONE('UTC',SCHEDARRIVDATE)) AS schedArrivDate," + "FROM ARRIVETABLE " +
"WHERE " +
"TO_DATE(CONVERT_TIMEZONE('UTC', 'UTC', NEEDARRIVDATE)) > TO_DATE(:date) ",
nativeQuery = true
)
DetailsProjection getDetails(@Param("date") Instant date);
I want it to work without any conversions as it is working for entities. Does the conversion or the way JPA handles the conversions for entity and projection differ?
What is the problem?