开发者

How to create auto increment primary key?

开发者 https://www.devze.com 2023-01-17 03:23 出处:网络
I am using Google AppEngine (Java) and would like to have the primary key to be auto incrementing, preferably increasing by 1.

I am using Google AppEngine (Java) and would like to have the primary key to be auto incrementing, preferably increasing by 1.

开发者_开发技巧

IdGeneratorStrategy.INCREMENT seems to be not supported in AppEngine.

Is IdGeneratorStrategy.SEQUENCE what I need?


Auto-incrementing IDs does not work on App Engine because of the way App Engine stores your data spread across multiple servers and potentially data centers.

You can simulate an auto-incrementing ID, but honestly, there is probably no good reason for needing one.

If unique IDs are what you need, those are the default. If you need to know how many rows have been created, that's also easy.

0

精彩评论

暂无评论...
验证码 换一张
取 消