[java] how to set length of an column in hibernate with maximum length

I want to save an object in data base.
I'm using MySQL data base, but when I try it I get an exception that says: "data is bigger than Column length".
How can I increase the length of my column using hibernate?

This question is related to java mysql hibernate

The answer is


if your column is varchar use annotation length

@Column(length = 255)

or use another column type

@Column(columnDefinition="TEXT")

Similar questions with java tag:

Similar questions with mysql tag:

Similar questions with hibernate tag: