white-yz opened a new issue #8048:
URL: https://github.com/apache/shardingsphere/issues/8048


   The int(or bigint) value is null, but jpa with shardingsphere-jdbc returns 
zero(or false)
   We use sharding-jdbc-spring-boot-starter 4.0.0-RC1 &  jpa to read records 
from MySQL 5.6,
   We found the cause of zero value.
   
org.apache.shardingsphere.shardingjdbc.jdbc.core.resultset.DatabaseMetaDataResultSet.java
   It define some methods,every method returns basic variable type such as 
boolean, int, long ...
   and in the 
org.apache.shardingsphere.shardingjdbc.jdbc.core.resultset.ResultSetUtil.java 
   convertNullValue(convertType) convert null value to basic value.
   `private static Object convertNullValue (final Class<?> convertType)  {
   
           switch (convertType.getName()) {
               case "boolean":
                   return false;
               case "byte":
                   return (byte) 0;
               case "short":
                   return (short) 0;
               case "int":
                   return 0;
               case "long":
                   return 0L;
               case "float":
                   return 0F;
               case "double":
                   return 0D;
               default:
                   return null;
           }
   }`
   If I want to get an NULL result,what should I do..
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to