CREATE TABLE IF NOT EXISTS `user` (
`USER_ID` bigint(20) NOT NULL auto_increment,
`USER_ABOUT_YOU` varchar(255) default NULL,
`USER_COMMUNITY` tinyblob,
`USER_COUNTRY` varchar(255) default NULL,
`USER_GENDER` varchar(255) default NULL,
`USER_MAILING_LIST` bit(1) default NULL,
`USER_NAME` varchar(255) default NULL,
`USER_PASSWORD` varchar(255) default NULL,
PRIMARY KEY (`USER_ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
为什么 USER_COMMUNITY 被定义为微小的 blob。该字段接受复选框值。当我将其更改为其他数据类型时,我收到错误?为什么会这样?
http://www.vaannila.com/spring/spring-hibernate-integration-1.html
最佳答案
它是这样定义的:
@Column(name="USER_COMMUNITY")
public String[] getCommunity() {
return community;
}
public void setCommunity(String[] community) {
this.community = community;
}
该表不存储检查,而是存储字符串数组。看起来,TINYBLOB
是 MYSQL 上用于存储数组的正确数据类型。
关于java - MySQL 字段类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4507272/