You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/11/06 07:04:02 UTC

[GitHub] [shardingsphere] white-yz opened a new issue #8048: The int(or bigint) value is null, but jpa with shardingsphere-jdbc returns zero(or false)

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:
users@infra.apache.org



[GitHub] [shardingsphere] kimmking commented on issue #8048: The int(or bit) value is null, but jpa with shardingsphere-jdbc returns zero(or false)

Posted by GitBox <gi...@apache.org>.
kimmking commented on issue #8048:
URL: https://github.com/apache/shardingsphere/issues/8048#issuecomment-722987810


   `int getInt()` is from JDBC ResultSet interface.
   
   ![image](https://user-images.githubusercontent.com/807508/98352372-e8cea600-2058-11eb-9492-670f706a8618.png)
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] kimmking edited a comment on issue #8048: The int(or bit) value is null, but jpa with shardingsphere-jdbc returns zero(or false)

Posted by GitBox <gi...@apache.org>.
kimmking edited a comment on issue #8048:
URL: https://github.com/apache/shardingsphere/issues/8048#issuecomment-722987810


   `int getInt()` is from JDBC ResultSet interface. It doesn't support NULL.
   
   ![image](https://user-images.githubusercontent.com/807508/98352372-e8cea600-2058-11eb-9492-670f706a8618.png)
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] kimmking closed issue #8048: The int(or bit) value is null, but jpa with shardingsphere-jdbc returns zero(or false)

Posted by GitBox <gi...@apache.org>.
kimmking closed issue #8048:
URL: https://github.com/apache/shardingsphere/issues/8048


   


----------------------------------------------------------------
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:
users@infra.apache.org