JPA: how do I persist a String into a database field, type MYSQL Text

前端 未结 3 1337
夕颜
夕颜 2020-12-02 09:48

The requirement is that the user can write an article, therefore I choose type Text for the content field inside mysql database. How can I convert

3条回答
  •  执念已碎
    2020-12-02 10:16

    for mysql 'text':

    @Column(columnDefinition = "TEXT")
    private String description;
    

    for mysql 'longtext':

    @Lob
    private String description;
    

提交回复
热议问题