Problem when wanting to mapping values from MySQL query to Object in JAVA but MySQL Query returns NULL
If Application is written in spring boot with JDBCTemplate and mapping to Object, the exception will occur.
org.springframework.beans.TypeMismatchException
can be solved by use IFNULL
SELECT IFNULL(emp_id,0) FROM emp WHERE 1=0;
Output
0
Reference:
https://dev.mysql.com/doc/refman/5.7/en/flow-control-functions.html
https://www.w3schools.com/sql/func_mysql_ifnull.asp
Top comments (0)