#what data type to use for storing ids?

11 messages · Page 1 of 1 (latest)

daring forge
#

hi guys. in java code i will need to use/store ids, that look like 11000000035. what data type to use? long or just String? because int in my case doesnt have enough storage for symbols. thanks

smoky nacelleBOT
#

This post has been reserved for your question.

Hey @daring forge! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

tulip iris
#

int is [-2,147,483,648, 2,147,483,647]. 11000000035 is a few timer bigger number. 11000000035 ÷ 2147483647 = 5,1222.
long is in range [-9,223,372,036,854,775,808, 9,223,372,036,854,775,807]. 9223372036854775807/11000000035=838488364.31888. Largest long value is 838488364 times bigger.
So use either long or string as you need.

smoky nacelleBOT
#

💤 Post marked as dormant

This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping.
Warning: abusing this will result in moderative actions taken against you.

brittle lagoon
#

I suggest you use Long(Wrapper) instead of long(primitive) as well.
It will save you headaches in the future.

gloomy blade
brittle lagoon
gloomy blade
#

in the REST API scenario is so vague. But why would you use a NULLABLE type when your number is mandatory?

#

Any half decent serde library should just be able to get the long out

rancid dew
#

Alternatively, UUID might be an option