-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: DB unsigned INTEGER mapping with int field does matter?
PostPosted: Fri Jan 20, 2006 3:30 am 
Newbie

Joined: Wed Nov 02, 2005 10:49 pm
Posts: 12
I am reading MySQL maual about AUTO_INCREMENT field, which indicates that "An AUTO_INCREMENT column works properly only if it contains only positive values".

a SQL snippet generated by MySQL QueryBrowser as following:

CREATE TABLE `user` (
`USER_ID` int(10) unsigned NOT NULL auto_increment,
`NAME` varchar(255) NOT NULL default '',
PRIMARY KEY (`USER_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

MySQL unsigned INTEGER type range from 0 to 4294967295, but Java int type range from -2147483648 to 2147483647, the USER_ID will be increased day by day, then exceeds max value 2147483647, and then.... does that means that if i mapping DB INT AUTO_INCREMENT with java int is a bad practice? anyone has any suggestions?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 20, 2006 9:15 am 
Newbie

Joined: Tue Jan 03, 2006 7:30 am
Posts: 18
Location: Budapest, Hungary
Well, yes, if you expect your database to grow beyond that size. But then you'll have trouble with MySQL's range as well. And, considering that the size of a database with this many entities would be a couple hundred gigabytes at least, you probably won't use MySQL for that task anyway.

So, first do a little math to see if this could be a problem for you. I'm pretty sure you'll find out it isn't.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.