How to use enums with JPA

前端 未结 11 1095
梦如初夏
梦如初夏 2020-12-03 02:47

I have an existing database of a film rental system. Each film has a has a rating attribute. In SQL they used a constraint to limit the allowed values of this attribute.

11条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-03 03:02

    use this annotation

    @Column(columnDefinition="ENUM('User', 'Admin')")
    

提交回复
热议问题