要求是用户可以写一篇文章,因此我选择mysql数据库中Text的content字段类型.我怎样才能转换Java String成MySQL Text
干得好 Jim Tough
@Entity
public class Article implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private Long userId;
private String title;
private String content;
private Integer vote;
//Constructors, setters, getters, equals and hashcode
}
Run Code Online (Sandbox Code Playgroud)
在我的MYSQL数据库中,content是类型Text.我希望会有这样的东西java.sql.Text,因为它java.sql.Blob是一个真实的类型,但遗憾的是,这不存在