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?
|