hibernate ifnull


mysql中sql語句的ifnull函數,在hibernate的hql中可用coalesce代替。

例:

mysql的sql:select ifnull(max(sort),0) from table;

hibernate的hql:select coalesce(max(sort),0) from table;

 

經測試,這2個sql在mysql中都能執行:

select ifnull(max(sort),0) from table;

select coalesce(max(sort),0) from table;

----------------------------------------------------------------------------------------

參考:https://forum.hibernate.org/viewtopic.php?f=1&t=938874

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM