Setix
Setix

Reputation: 141

JPA 2.0 Data too long for Column in a List

I have a list of strings defined for Keywords in my Object model:

/**
 * List of keywords
 */
@Column(name="KEYWORDS")
@CollectionTable(name="pub_keywords",joinColumns=@JoinColumn(name="publicationid"))
@ElementCollection
private List<String> keywords;

However some piece of data I'm getting it too big to fit into the db. And is throwing the following error:

Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'KEYWORDS' at row 1

I know that I can use @Lob on a String element to increase size, but how do I define a list of @Lob elements?

Thanks

Upvotes: 0

Views: 323

Answers (1)

crizzis
crizzis

Reputation: 10726

According to the javadoc:

The Lob annotation may be used in conjunction with the Basic annotation or the ElementCollection annotation when the element collection value is of basic type

Source: http://docs.oracle.com/javaee/6/api/javax/persistence/Lob.html

Upvotes: 1

Related Questions