You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/02/16 12:33:01 UTC

[GitHub] [shardingsphere] ionauq opened a new issue #15451: shardingsphere-jdbc with jdbcTemplate.update() throw null exception

ionauq opened a new issue #15451:
URL: https://github.com/apache/shardingsphere/issues/15451


   ## Question
   
   when i use `shardingsphere-jdbc-core` `5.0.0` with  `JdbcTemplate.update()` in readwrite-splitting mode, the  `keyHolder` return null.
   
   example:
   
   ```
     GeneratedKeyHolder keyHolder = new GeneratedKeyHolder();
           int row = jdbcTemplate.update((conn) -> {
               PreparedStatement ps = conn.prepareStatement("insert into tags (app_id, name) value(?, ?)", Statement.RETURN_GENERATED_KEYS);
               ps.setLong(1, 1L);
               ps.setString(2, "test");
               return ps;
           }, keyHolder);
   
           long id = keyHolder.getKey().longValue();
   ```
   
   ![image](https://user-images.githubusercontent.com/4327765/154261641-b06ba707-8860-4c1f-8552-c27b643de862.png)
   
   ![image](https://user-images.githubusercontent.com/4327765/154264243-e8c149ec-5062-4f62-b75d-aeb356f9ae2e.png)
   
   The program runs to `new GeneratedKeysResultSet`,  if the column is not null, the program is normal.
   
   Do I need to configure specific information? 
   
   thanks
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] strongduanmu commented on issue #15451: shardingsphere-jdbc with jdbcTemplate.update() throw null exception

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #15451:
URL: https://github.com/apache/shardingsphere/issues/15451#issuecomment-1042767425


   @ionauq I'm very sorry, as 5.1.0 has just been released, the next version may take some time. If you rely on this bug fix, consider packaging it yourself.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] strongduanmu commented on issue #15451: shardingsphere-jdbc with jdbcTemplate.update() throw null exception

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #15451:
URL: https://github.com/apache/shardingsphere/issues/15451#issuecomment-1042681012


   Hi @ionauq, can you help test this problem with master branch? You can execute `mvn clean install -Dmaven.javadoc.skip=true -B -Drat.skip=true -Djacoco.skip=true -Dmaven.test.skip=true -Prelease -T 1C` on your machine.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] ionauq commented on issue #15451: shardingsphere-jdbc with jdbcTemplate.update() throw null exception

Posted by GitBox <gi...@apache.org>.
ionauq commented on issue #15451:
URL: https://github.com/apache/shardingsphere/issues/15451#issuecomment-1042762320


   > Hi @ionauq, can you help test this problem with master branch? You can execute `mvn clean install -Dmaven.javadoc.skip=true -B -Drat.skip=true -Djacoco.skip=true -Dmaven.test.skip=true -Prelease -T 1C` on your machine.
   
   It's so efficient!  The test passed under my use case. Thanks!!!
   When will the next stable version be released?


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] strongduanmu commented on issue #15451: shardingsphere-jdbc with jdbcTemplate.update() throw null exception

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #15451:
URL: https://github.com/apache/shardingsphere/issues/15451#issuecomment-1042460746


   Hi @ionauq, I have tested with PreparedStatement and generatedKeys are fetched normally. I'm not very familiar with JdbcTemplate, does it depend on the columnName field? If you can provide a demo, I believe the problem will be solved quickly.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] ionauq commented on issue #15451: shardingsphere-jdbc with jdbcTemplate.update() throw null exception

Posted by GitBox <gi...@apache.org>.
ionauq commented on issue #15451:
URL: https://github.com/apache/shardingsphere/issues/15451#issuecomment-1042563454


   > Hi @ionauq, I have tested with PreparedStatement and generatedKeys are fetched normally. I'm not very familiar with JdbcTemplate, does it depend on the columnName field? If you can provide a demo, I believe the problem will be solved quickly.
   
   thanks.  I write a simple demo. 
   
    [shardingJdbcDemo](https://github.com/ionauq/shardingJdbcDemo)


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] strongduanmu commented on issue #15451: shardingsphere-jdbc with jdbcTemplate.update() throw null exception

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #15451:
URL: https://github.com/apache/shardingsphere/issues/15451#issuecomment-1042440074


   Hi @ionauq, thank you for your feedback. It looks like a bug, I will investigate this issue.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] strongduanmu commented on issue #15451: shardingsphere-jdbc with jdbcTemplate.update() throw null exception

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #15451:
URL: https://github.com/apache/shardingsphere/issues/15451#issuecomment-1042574433


   @ionauq Thank you, I will check it again.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] tristaZero closed issue #15451: shardingsphere-jdbc with jdbcTemplate.update() throw null exception

Posted by GitBox <gi...@apache.org>.
tristaZero closed issue #15451:
URL: https://github.com/apache/shardingsphere/issues/15451


   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] ionauq commented on issue #15451: shardingsphere-jdbc with jdbcTemplate.update() throw null exception

Posted by GitBox <gi...@apache.org>.
ionauq commented on issue #15451:
URL: https://github.com/apache/shardingsphere/issues/15451#issuecomment-1042769198


   > @ionauq I'm very sorry, as 5.1.0 has just been released, the next version may take some time. If you rely on this bug fix, consider packaging it yourself.
   
   ok, thanks! 


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org