{"action":"created","issue":{"url":"https://api.github.com/repos/mybatis/mybatis-3/issues/1183","repository_url":"https://api.github.com/repos/mybatis/mybatis-3","labels_url":"https://api.github.com/repos/mybatis/mybatis-3/issues/1183/labels{/name}","comments_url":"https://api.github.com/repos/mybatis/mybatis-3/issues/1183/comments","events_url":"https://api.github.com/repos/mybatis/mybatis-3/issues/1183/events","html_url":"https://github.com/mybatis/mybatis-3/issues/1183","id":293478321,"number":1183,"title":"useGeneratedKeys=true seems not working properly with sybase ase 15.7","user":{"login":"yaoweijq","id":36033910,"avatar_url":"https://avatars3.githubusercontent.com/u/36033910?v=4","gravatar_id":"","url":"https://api.github.com/users/yaoweijq","html_url":"https://github.com/yaoweijq","followers_url":"https://api.github.com/users/yaoweijq/followers","following_url":"https://api.github.com/users/yaoweijq/following{/other_user}","gists_url":"https://api.github.com/users/yaoweijq/gists{/gist_id}","starred_url":"https://api.github.com/users/yaoweijq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yaoweijq/subscriptions","organizations_url":"https://api.github.com/users/yaoweijq/orgs","repos_url":"https://api.github.com/users/yaoweijq/repos","events_url":"https://api.github.com/users/yaoweijq/events{/privacy}","received_events_url":"https://api.github.com/users/yaoweijq/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-01T10:30:28Z","updated_at":"2018-02-01T11:05:39Z","closed_at":null,"author_association":"NONE","body":"Bug report?\r\n======================\r\nPlease fill out the BUG REPORT FORM below.\r\n\r\nTo fix a bug, we need to reproduce it first.\r\nAnd we spend a lot of time just trying to reproduce the reported problem, so please consider creating a failing test case or an example project.\r\n\r\n- How to create a test case : https://github.com/mybatis/mybatis-3/wiki/Unit-Test\r\n- How to create a good example : http://sscce.org\r\n- How to upload your project to GitHub: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/\r\n\r\nFeature request?\r\n=======================\r\n- Please delete the BUG REPORT FORM below and describe the feature.\r\n- It is a good idea to discuss your changes on the mailing list to get feedback from the community. http://groups.google.com/group/mybatis-user\r\n- If you have a patch with unit tests, send a pull request. Please see the wiki page : https://github.com/mybatis/mybatis-3/wiki/Contribute\r\n-->\r\n\r\n<!-- BUG REPORT FORM -->\r\n\r\n## MyBatis version\r\n3.4.5\r\n\r\n## Database vendor and version\r\n1> select @@version\r\n2> go\r\n                                                                                                                                                                                                                                                                 \r\n --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- \r\n Adaptive Server Enterprise/15.7/EBF 25127 SMP SP136 /P/x86_64/Enterprise Linux/ase157sp136x/3955/64-bit/FBO/Mon Oct 19 19:12:00 2015         \r\n## Test case or example project\r\n1> create table test(tid int identity not null, tname varchar(30) null)\r\n2> go\r\n\r\nMapper:\r\npublic interface TestMapper {\r\n\r\n    void test(Test t);\r\n}\r\njunit test case\r\n    @Test\r\n    public void gg(){\r\n        bean.Test t = new bean.Test();\r\n        t.setName(\"abcd\");\r\n        mapper.test(t);\r\n    }\r\n\r\nbean:\r\npublic class Test {\r\n\r\n    private int id;\r\n    private String name;\r\n    public Test(){}\r\n    public int getId() {\r\n        return id;\r\n    }\r\n    public void setId(int id) {\r\n        this.id = id;\r\n    }\r\n    public String getName() {\r\n        return name;\r\n    }\r\n    public void setName(String name) {\r\n        this.name = name;\r\n    }\r\n}\r\n\r\nxml:\r\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<!DOCTYPE mapper PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\" \"http://mybatis.org/dtd/mybatis-3-mapper.dtd\">\r\n<mapper namespace=\"bean.TestMapper\">\r\n\r\n    <resultMap type=\"bean.Test\" id=\"testmap\">\r\n        <id property=\"id\" column=\"ID\" />\r\n        <result property=\"name\" column=\"NAME\" />\r\n    </resultMap>\r\n    <insert id=\"test\"  parameterType=\"bean.Test\" useGeneratedKeys=\"true\">\r\n    insert into test values(#{name})\r\n    </insert>\r\n</mapper>\r\n\r\n## Steps to reproduce\r\nrun test case\r\n## Expected result\r\nget the generated id in test.id\r\n## Actual result\r\nCaused by: java.sql.SQLException: JZ0NK: Generated keys are not available because either the Statement.NO_GENERATED_KEYS was used or no keys were automatically generated.\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/mybatis/mybatis-3/issues/comments/362233330","html_url":"https://github.com/mybatis/mybatis-3/issues/1183#issuecomment-362233330","issue_url":"https://api.github.com/repos/mybatis/mybatis-3/issues/1183","id":362233330,"user":{"login":"yaoweijq","id":36033910,"avatar_url":"https://avatars3.githubusercontent.com/u/36033910?v=4","gravatar_id":"","url":"https://api.github.com/users/yaoweijq","html_url":"https://github.com/yaoweijq","followers_url":"https://api.github.com/users/yaoweijq/followers","following_url":"https://api.github.com/users/yaoweijq/following{/other_user}","gists_url":"https://api.github.com/users/yaoweijq/gists{/gist_id}","starred_url":"https://api.github.com/users/yaoweijq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yaoweijq/subscriptions","organizations_url":"https://api.github.com/users/yaoweijq/orgs","repos_url":"https://api.github.com/users/yaoweijq/repos","events_url":"https://api.github.com/users/yaoweijq/events{/privacy}","received_events_url":"https://api.github.com/users/yaoweijq/received_events","type":"User","site_admin":false},"created_at":"2018-02-01T11:05:39Z","updated_at":"2018-02-01T11:05:39Z","author_association":"NONE","body":"if use xml as the following, the generated key is always 0\r\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<!DOCTYPE mapper PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\" \"http://mybatis.org/dtd/mybatis-3-mapper.dtd\">\r\n<mapper namespace=\"bean.TestMapper\">\r\n\r\n    <resultMap type=\"bean.Test\" id=\"testmap\">\r\n        <id property=\"id\" column=\"ID\" />\r\n        <result property=\"name\" column=\"NAME\" />\r\n    </resultMap>\r\n    <insert id=\"test\"  parameterType=\"bean.Test\" useGeneratedKeys=\"true\">\r\n    insert into test values(#{name})\r\n    <selectKey resultType=\"java.lang.Integer\" keyProperty=\"id\">\r\n     select @@identity as id\r\n    </selectKey>\r\n    </insert>\r\n</mapper>"}}
{"actor":{"display_login":"yaoweijq"}}