Hi all.
Im new(noob) with hibernate and im trying to write this code in HQL but isnt working right:
In DB2:
SELECT *
FROM TABLE
WHERE column = COALESCE(CAST(variable AS INT), column)
In HQL I wrote:
select t from Table t where t.column = coalesce(cast(?1 as integer), t.column)
But in HQL doenst work correctly when I send a null value, ant this exception rise:
org.springframework.orm.jpa.JpaSystemException: org.hibernate.exception.SQLGrammarException: could not execute query; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
|