yunmengmeng opened a new issue, #18904:
URL: https://github.com/apache/shardingsphere/issues/18904

   first,when using <b>AUTO_INCREMENT,useGeneratedKeys,insert null </b>will 
cause the exception `ResultSet should call next or has no more data.`,it seems 
to this issue  #18212  
([here](https://github.com/apache/shardingsphere/issues/18212)) ,it has been 
resolved to  #18224. 
([here](https://github.com/apache/shardingsphere/pull/18224))
   
   now i use @Transactional,insert for many times,it returns the first one's id.
   
   ### Which version of ShardingSphere did you use?
   5.1.2
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-JDBC
   ### Expected behavior
   the newest id
   ### Actual behavior
   the first id
   ### Reason analyze (If you can)
   the first insert,set the right id
   
![image](https://user-images.githubusercontent.com/46476040/177537165-1360b01f-b665-4028-8aba-9d99d9b2b285.png)
   
   the second insert,generatedValues not clear
   
![image](https://user-images.githubusercontent.com/46476040/177537565-972785be-b138-4ab2-a768-bdfa189f800d.png)
   
   then the ResultSet returns the first value
   
![image](https://user-images.githubusercontent.com/46476040/177537901-bedbabda-13ce-48f9-86f2-ea3fabc7c041.png)
   
   it's why this bug appears
   
![image](https://user-images.githubusercontent.com/46476040/177538588-0a71ebf2-5443-4658-a5a3-ed2050a6d678.png)
   
![image](https://user-images.githubusercontent.com/46476040/177538614-23cc8d36-f1d1-4a94-a3d4-abafda003e63.png)
   
   
   ### Example codes for reproduce this issue (such as a github link).
   ```
       @Transactional
       @Override
       public void idList() {
           for (int i = 0; i < 5; i++) {
               Tree tree = new Tree();
               tree.setId(null);
               tree.setPid(i);
               mapper.insertTree(tree);
               int x = 1;
           }
       }
   
   <insert id="insertTree" useGeneratedKeys="true" keyProperty="id">
       INSERT INTO tree(id,pid) VALUES (#{id},#{pid})
   </insert>
   ```
   


-- 
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.

To unsubscribe, e-mail: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to