My Spring boot 2.7.5 app with PostgreSQL gives back an error when I try to run a nativeQuery:
@Query(value = """select import, export from
(select cast(max(sd.value) - min(sd.value) as float8)
from solar_data sd
where sd.device_address = :deviceAddress
and sd.tstamp between :from and now()) as import,
(select cast(max(sd.value) - min(sd.value) as float8)
from solar_data sd
where sd.device_address = :deviceAddress
and sd.tstamp between :from and now ()) as export
""", nativeQuery=true)
fun getMainScreenData(@Param("deviceAddress") deviceAddress:Long, @Param("from")
from:LocalDateTime) : List<Impex>
It gives back two floats as import and export. My result interface is:
interface Impex {
fun getImport():Float
fun getExport():Float
}
Jpa error message is:
org.hibernate.MappingException: No Dialect mapping for JDBC type: 1111
org.hibernate.dialect.TypeNames.get(TypeNames.java:71)
org.hibernate.dialect.TypeNames.get(TypeNames.java:103)
org.hibernate.dialect.Dialect.getHibernateTypeName(Dialect.java:741)
I use dialect as
spring:
jpa:
databasePlatform: org.hibernate.dialect.PostgreSQL10Dialect
I tried casting as float and float8 in sql but the result is same. How can I execute this native query?