Reputation: 1389
Once total length of Map String(s) is greater than 255, JPA fails committing transaction. I'm using JPA 2.0 with Play 2 Framework.
@ElementCollection
private Map<EmailNotificationType, String> mailContents = new HashMap<>();
I tried
@Column(length = 2048)
@Lob
@MapKeyColumn(length = 2048)
I would like to persist as much as it's possible since its size is dynamic.
Upvotes: 5
Views: 12913
Reputation: 1619
For people who landet here by google:
Answer is:
@Column(columnDefinition = "TEXT")
or
@Column(columnDefinition = "LONGTEXT")
The old DB content of the DB must be deleted before, like create-drop. Update is not working.
Upvotes: 11
Reputation: 2409
I think you are using varchar(255)
. Use a text
column instead of varchar(255)
.
In PostgreSQL always use text (unless of course there is a real length constraint).
Upvotes: 5