rboleynl opened a new issue #2926: mysql page limit Long parameter type error
URL: https://github.com/apache/incubator-shardingsphere/issues/2926
 
 
   ## Bug Report
   
   **For English only**, other languages will not accept.
   
   Before report a bug, make sure you have:
   
   - Searched open and closed [GitHub 
issues](https://github.com/apache/incubator-shardingsphere/issues).
   - Read documentation: [ShardingSphere 
Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   Please pay attention on issues you submitted, because we maybe need more 
details. 
   If no response **more than 7 days** and we cannot reproduce it on current 
information, we will **close it**.
   
   Please answer these questions before submitting your issue. Thanks!
   
   ### Which version of ShardingSphere did you use?
   4.0.0-RC2-SNAPSHOT(clone from dev branch)
   ### Which project did you use? Sharding-JDBC or Sharding-Proxy?
   Sharding-JDBC
   ### Expected behavior
   sql execute success
   ### Actual behavior
   Caused by: java.lang.ClassCastException: java.lang.Long cannot be cast to 
java.lang.Integer
   ### Reason analyze (If you can)
   my code below:
   public List<User> findUsersByPageIntType(Integer begin, Integer end){
                String sql = "select id,name,age,email from user limit ?,? ";
                Object[] params = new Object[] {begin, end};
                List<User> userList = jdbcTemplate.query(sql, params, 
getUserMapper());
                return userList;
        }
   public List<User> findUsersByPageLongType(Long begin, Long end){
                String sql = "select id,name,age,email from user limit ?,? ";
                Object[] params = new Object[] {begin, end};
                List<User> userList = jdbcTemplate.query(sql, params, 
getUserMapper());
                return userList;
        }
        
        
   first, call findUsersByPageIntType method, it's ok
   but call findUsersByPageLongType method there was an error -> Caused by: 
java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   1.application.properties
   spring.shardingsphere.datasource.names=ds0
   spring.shardingsphere.datasource.ds0.type=com.zaxxer.hikari.HikariDataSource
   spring.shardingsphere.datasource.ds0.driver-class-name=com.mysql.jdbc.Driver
   
spring.shardingsphere.datasource.ds0.jdbc-url=jdbc:mysql://127.0.0.1:3306/ttx_util?useUnicode=true&useSSL=false&characterEncoding=utf8
   spring.shardingsphere.datasource.ds0.username=test
   spring.shardingsphere.datasource.ds0.password=test
   
   
spring.shardingsphere.sharding.tables.user.actual-data-nodes=ds0.user_$->{0..1}
   
spring.shardingsphere.sharding.tables.user.table-strategy.inline.sharding-column=erp_id
   
spring.shardingsphere.sharding.tables.user.table-strategy.inline.algorithm-expression=user_$->{erp_id
 % 2}
   spring.shardingsphere.sharding.tables.user.key-generator.column=id
   spring.shardingsphere.sharding.tables.user.key-generator.type=SNOWFLAKE
   #是否开启SQL显示,默认值: false
   spring.shardingsphere.props.sql.show=true
   2.table create sql:
   CREATE TABLE `user_0` (
     `id` bigint(20) NOT NULL COMMENT '主键ID',
        `erp_id` int(11) NOT NULL COMMENT '分表erpId',
     `name` varchar(30) DEFAULT NULL COMMENT '姓名',
     `age` int(11) DEFAULT NULL COMMENT '年龄',
     `email` varchar(50) DEFAULT NULL COMMENT '邮箱',
     PRIMARY KEY (`id`)
   ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
   
   CREATE TABLE `user_1` (
     `id` bigint(20) NOT NULL COMMENT '主键ID',
        `erp_id` int(11) NOT NULL COMMENT '分表erpId',
     `name` varchar(30) DEFAULT NULL COMMENT '姓名',
     `age` int(11) DEFAULT NULL COMMENT '年龄',
     `email` varchar(50) DEFAULT NULL COMMENT '邮箱',
     PRIMARY KEY (`id`)
   ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
   ### Example codes for reproduce this issue (such as a github link).
   

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to