In spring-roo entity, I define a content field to record the content of the article:
@NotNull
private String content;
But in mysql field, it mapped to varchar(255), it's too short to record a content of article so the following exception thrown:
ERROR org.hibernate.util.JDBCExceptionReporter - Data truncation: Data too long for column 'content' at row 1
My question is what's the big string field type in mysql? (In access db, it's "memo"), how to define this annotation in Spring Roo to make it record more data? Thanks
One option would be to add the Size annotation, e.g.
@NotNull
@Size(max = 500)
private java.lang.String content;
Another option would be to use a LOB field:
@NotNull
@Lob
private byte[] content;
If I need a String field larger than about 255 characters, I usually use a LOB field. However, note that it is generally not possible to search for data inside a LOB field.