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 2020/02/21 09:10:45 UTC

[GitHub] [incubator-shardingsphere] ICanFlyFaraway opened a new issue #4402: I want to use the self growing primary key. Is there any scheme available?

ICanFlyFaraway opened a new issue #4402: I want to use the self growing primary key. Is there any scheme available?
URL: https://github.com/apache/incubator-shardingsphere/issues/4402
 
 
   I have looked up the src demo, there are only there default way :
   1、Snowflake algorithm
   2、timestamp
   3、UUID
   And in my program,when I insert a piece of data,i want get my primary key(ID) back.Thank you for your reply :)。

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] kimmking commented on issue #4402: I want to use the self growing primary key. Is there any scheme available?

Posted by GitBox <gi...@apache.org>.
kimmking commented on issue #4402: I want to use the self growing primary key. Is there any scheme available?
URL: https://github.com/apache/incubator-shardingsphere/issues/4402#issuecomment-596355743
 
 
   I think we should close this issue now.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] beckhampu commented on issue #4402: I want to use the self growing primary key. Is there any scheme available?

Posted by GitBox <gi...@apache.org>.
beckhampu commented on issue #4402: I want to use the self growing primary key. Is there any scheme available?
URL: https://github.com/apache/incubator-shardingsphere/issues/4402#issuecomment-596360221
 
 
   @kimmking , i think so. I  will close it.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] ICanFlyFaraway commented on issue #4402: I want to use the self growing primary key. Is there any scheme available?

Posted by GitBox <gi...@apache.org>.
ICanFlyFaraway commented on issue #4402: I want to use the self growing primary key. Is there any scheme available?
URL: https://github.com/apache/incubator-shardingsphere/issues/4402#issuecomment-590636781
 
 
   OK,i have implements ShardingKeyGenerator.java,can I use the any interface of the shrding-proxy to excute the sql like “select max(id)...” to get current max id?Or i just use use the original jdbc to get it ?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] kimmking commented on issue #4402: I want to use the self growing primary key. Is there any scheme available?

Posted by GitBox <gi...@apache.org>.
kimmking commented on issue #4402: I want to use the self growing primary key. Is there any scheme available?
URL: https://github.com/apache/incubator-shardingsphere/issues/4402#issuecomment-590083613
 
 
   You can use autocrement id just like directly using jdbc, then sharding-proxy is a transparent proxy.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] beckhampu commented on issue #4402: I want to use the self growing primary key. Is there any scheme available?

Posted by GitBox <gi...@apache.org>.
beckhampu commented on issue #4402: I want to use the self growing primary key. Is there any scheme available?
URL: https://github.com/apache/incubator-shardingsphere/issues/4402#issuecomment-591409123
 
 
   @kimmking ,maybe you are right.  @ICanFlyFaraway ,  can you give us some more details ?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] ICanFlyFaraway commented on issue #4402: I want to use the self growing primary key. Is there any scheme available?

Posted by GitBox <gi...@apache.org>.
ICanFlyFaraway commented on issue #4402: I want to use the self growing primary key. Is there any scheme available?
URL: https://github.com/apache/incubator-shardingsphere/issues/4402#issuecomment-589565795
 
 
   I just use sharding-proxy 4.0.0

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] beckhampu closed issue #4402: I want to use the self growing primary key. Is there any scheme available?

Posted by GitBox <gi...@apache.org>.
beckhampu closed issue #4402: I want to use the self growing primary key. Is there any scheme available?
URL: https://github.com/apache/incubator-shardingsphere/issues/4402
 
 
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] kimmking commented on issue #4402: I want to use the self growing primary key. Is there any scheme available?

Posted by GitBox <gi...@apache.org>.
kimmking commented on issue #4402: I want to use the self growing primary key. Is there any scheme available?
URL: https://github.com/apache/incubator-shardingsphere/issues/4402#issuecomment-591378420
 
 
   I guess max(id) is not nessesary and not exactly right.
   If you use JDBC directly, use `select last_id()`  after insert a row in the same transaction to be better.
   If you use mybatis, you can config mapper like this:
   `<insert id="insert" keyProperty="id" useGeneratedKeys="true" ...`

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] beckhampu commented on issue #4402: I want to use the self growing primary key. Is there any scheme available?

Posted by GitBox <gi...@apache.org>.
beckhampu commented on issue #4402: I want to use the self growing primary key. Is there any scheme available?
URL: https://github.com/apache/incubator-shardingsphere/issues/4402#issuecomment-590800112
 
 
   @ICanFlyFaraway , i think you already know how to get the self-incrementing primary key. And  as you said,  now you can execute the SQL through jdbc to get the current maximum id.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] ICanFlyFaraway edited a comment on issue #4402: I want to use the self growing primary key. Is there any scheme available?

Posted by GitBox <gi...@apache.org>.
ICanFlyFaraway edited a comment on issue #4402: I want to use the self growing primary key. Is there any scheme available?
URL: https://github.com/apache/incubator-shardingsphere/issues/4402#issuecomment-590636781
 
 
   @kimmking OK,i have implements ShardingKeyGenerator.java,can I use the any interface of the shrding-proxy to excute the sql like “select max(id)...” to get current max id?Or i just use use the original jdbc to get it ?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] beckhampu edited a comment on issue #4402: I want to use the self growing primary key. Is there any scheme available?

Posted by GitBox <gi...@apache.org>.
beckhampu edited a comment on issue #4402: I want to use the self growing primary key. Is there any scheme available?
URL: https://github.com/apache/incubator-shardingsphere/issues/4402#issuecomment-591409123
 
 
   @kimmking ,  maybe you are right.  @ICanFlyFaraway ,  can you give us some more details ?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] kimmking edited a comment on issue #4402: I want to use the self growing primary key. Is there any scheme available?

Posted by GitBox <gi...@apache.org>.
kimmking edited a comment on issue #4402: I want to use the self growing primary key. Is there any scheme available?
URL: https://github.com/apache/incubator-shardingsphere/issues/4402#issuecomment-591378420
 
 
   I guess max(id) is not nessesary and not exactly right.
   If you use JDBC directly, use `select last_insert_id()`  after insert a row in the same transaction to be better.
   If you use mybatis, you can config mapper like this:
   `<insert id="insert" keyProperty="id" useGeneratedKeys="true" ...`

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] terrymanu commented on issue #4402: I want to use the self growing primary key. Is there any scheme available?

Posted by GitBox <gi...@apache.org>.
terrymanu commented on issue #4402: I want to use the self growing primary key. Is there any scheme available?
URL: https://github.com/apache/incubator-shardingsphere/issues/4402#issuecomment-589583529
 
 
   Generated key can return via standard JDBC method.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services