How map a bit type in Mysql to hibernate?

前端 未结 4 1637
情书的邮戳
情书的邮戳 2021-01-04 14:20

i use the reverse engeneering in my class and get this:

@Entity
@Table(name = \"user\", catalog = \"bytecode\", uniqueConstraints =
@UniqueConstraint(columnN         


        
4条回答
  •  Happy的楠姐
    2021-01-04 14:44

    Do you have to have it as a bit type in MySQL? The easiest solution would be to change the data type in MySQL to tinyint(1).

    Otherwise you should be able to map your entity type to an integer using annotations; Not sure about this, have to look it up

    ...
    @Column(nullable=false)
    @Type(type="org.hibernate.type.BooleanType")
    private short type;
    

提交回复
热议问题