yunmengmeng commented on code in PR #18905:
URL: https://github.com/apache/shardingsphere/pull/18905#discussion_r928378079


##########
shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/ReadwriteSplittingPreparedStatementTest.java:
##########
@@ -92,4 +94,28 @@ public void assertGetGeneratedKeysWithPrimaryKeyIsNull() 
throws SQLException {
             assertFalse(generatedKeys.next());
         }
     }
+    
+    @Test
+    public void assertGetGeneratedKeysWithPrimaryKeyIsNullInTransactional() 
throws SQLException {
+        try (
+                Connection connection = getReadwriteSplittingDataSource()
+                        .getConnection();
+                PreparedStatement preparedStatement = 
connection.prepareStatement("INSERT INTO t_config(id, status) VALUES(?, ?);", 
Statement.RETURN_GENERATED_KEYS)) {
+            connection.setAutoCommit(false);
+            Object lastGeneratedId = null;
+            Object generatedId = null;
+            for (int i = 1; i <= 3; i++) {
+                preparedStatement.setObject(1, null);
+                preparedStatement.setString(2, "OK");
+                preparedStatement.executeUpdate();
+                ResultSet generatedKeys = preparedStatement.getGeneratedKeys();
+                assertTrue(generatedKeys.next());
+                generatedId = generatedKeys.getObject(1);
+                assertNotEquals(lastGeneratedId, generatedId);

Review Comment:
   ok



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