相关疑难解决方法(0)

如何将Mysql中的位类型映射到hibernate?

我在班上使用逆向工程并得到这个:

@Entity
@Table(name = "user", catalog = "bytecode", uniqueConstraints =
@UniqueConstraint(columnNames = "email"))
public class User implements java.io.Serializable {

    private Integer id;
    private String email;
    private String password;
    private boolean type;
Run Code Online (Sandbox Code Playgroud)

数据库:

CREATE TABLE  `bytecode`.`user` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `email` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL,
  `type` bit(1) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `email` (`email`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
Run Code Online (Sandbox Code Playgroud)

但是我不想在我的属性'type'中设置'true'或'false'但是1或0.我怎么能在hibernate中做到这一点?

此致,Valter Henrique.

java mysql jsp hibernate servlets

9
推荐指数
2
解决办法
2万
查看次数

标签 统计

hibernate ×1

java ×1

jsp ×1

mysql ×1

servlets ×1