Dominik Filipiak
Dominik Filipiak

Reputation: 1272

Spring roo entities - storing long strings

I have to store long strings in MySQL database using spring roo. I assumed that "field string" command generates field with size 255 which is too small. I prefer to not use blob. What should I do?

Upvotes: 0

Views: 1258

Answers (1)

tewe
tewe

Reputation: 2829

If you create the field using a command like field string --fieldName field1 --sizeMax 500 then Roo will annotate the field with @Size(max = 500) and it works for me if I let Hibernate to create the database schema.

(--sizeMax is an optional parameter, you can display all optional parameters after you defined all mandatory ones with -- and hitting TAB)

Another solution is to add manually the JPA annotation on the field: @Column(length=500). Or if you don't generate the database schema but create it by hand then you can define your column as you like.

Upvotes: 2

Related Questions