Alex Rivera | Logout

JPA and PostqreSQL: long string persistence

Asked 2009-12-09T00:46:25.567
20

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.

Edit
Report

1 Answer

17

I had the same case today. Just

@Lob
private String  body;

should create a db column of typ "text" (PostgreSQL - variable unlimited length) but the table should be regenerated.

answered 2012-06-14T08:21:13.160

Your Answer