ISNULL vs IFNULL and JPA/Hibernate

2,488 views
Skip to first unread message

Sebastian Paul

unread,
Feb 7, 2012, 11:00:15 AM2/7/12
to H2 Database
Hi,
I'm using H2 via Hibernates EntityManager and noticed that the JPQL
function "ISNULL" does not work (function not found). I looked into
H2Dialect, and obviously translation of ISNULL is not covered. Maybe
it should use registerFunction to map from ISNULL to IFNULL.
However, COLESCE works fine, no need to use a custom dialect for this.
Maybe COALESCE should be used in favor to ISNULL. The TSQL (MS SQL
Server) documentation categorizes ISNULL as system function (http://
msdn.microsoft.com/en-us/library/ms184325.aspx) and CALESCE (together
with CASE and NULLIF) as expressions (http://msdn.microsoft.com/en-us/
library/ms190349.aspx).
Strange that this does not work out-of-the-box with H2, and I did not
find related information or bug reports. And why is ISNULL contained
in the JPA 2 specification?

Cheers, Sebastian

Thomas Mueller

unread,
Apr 29, 2012, 11:01:53 AM4/29/12
to h2-da...@googlegroups.com
Hi,

In the next release of H2, ISNULL will be supported (as an alias for IFNULL).

Regards,
Thomas
> --
> You received this message because you are subscribed to the Google Groups "H2 Database" group.
> To post to this group, send email to h2-da...@googlegroups.com.
> To unsubscribe from this group, send email to h2-database...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
>
Reply all
Reply to author
Forward
0 new messages