what data type to use for storing ids?
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. thanks9 Replies
⌛
This post has been reserved for your question.
Hey @bambyzas! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose 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.
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.
💤
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.
I suggest you use Long(Wrapper) instead of long(primitive) as well.
It will save you headaches in the future.
If you always have it, use the primitive
Why?
I mean, in the REST API scenario, I had a headache using primitives as method parameters.
Using long, showed up a error. On the other hand, using Long, it worked smoothly.
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
Alternatively,
UUID
might be an option💤
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.