Skip to content

无法插入其他自增主键的表,从1.4.2升级到1.5.3出现的bug #370

Closed
@pptom

Description

Please answer these questions before submitting your issue. Thanks!

Which version of Sharding-Jdbc do you using?

1.5.3

Expected behavior

自增主键的表应该能正常插入,现在不能正常插入。

Actual behavior

抛出异常:详情看demo
java.sql.SQLException: Generated keys not requested. You need to specify Statement.RETURN_GENERATED_KEYS to Statement.executeUpdate(), Statement.executeLargeUpdate() or Connection.prepareStatement().

Steps to reproduce the behavior

重现步骤
1.执行demo中的sql文件建表
2.配置application.properties中的数据库连接信息
3.运行DemoSjApplication类里的主函数
3.打开 http://localhost:8080/ 返回json串则正常添加,否则出现上述所说的异常。。
/*
pom文件里注释1.5.3 的引入,切换为 1.4.2则可正常返回
根据tangmin721 所说的,我测试了下,1.5.2是正常的,1.5.3就不行了。
*/

Please provide the reproduce example codes (such as github link) if possible.

demo地址:https://github.com/pptom/demo-sj

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions