tags:

views:

395

answers:

2

Can anybody tell me how to persist long text using JPA (I use PostgreSQL)?

Here's the way I defined a very long string in my class:

@Lob
private String  body;

However, this produces a field of type charactervarying(255) in the database.

Furthermore, I've tried to use @Column annotation:

@Column(columnDefinition="TEXT")
private String  body;

But everything in vain.

I would be gratefull for a helpfull comment on this problem.

A: 
@Column(columnDefinition="TEXT")

is indeed the way to do it. Perhaps you have to regenerate your DDL?

Jonathan Feinberg
Unfortunately, it seems that @Column annotation is completely ignored.
emanemos
A: 

Worked fine for me.

malacma