0

I get an internal exception: org.postgresql.util.PSQLException: Error value too long for varying character (255) when i try to insert using EclipseLink JPA a value for a description on a certain entity. I thought using the @LOB annotation and setting a max length on the column would take care of it as follows:

@Size(min = 0, max = 9000)
@Lob
@Column(name = "description", length = 2000)
private String description;

but this does not solve the problem, how can i specify that i want a non binding length for this column as it could be very large

Warz
  • 7,386
  • 14
  • 68
  • 120
  • Use a `text` column instead of `varchar(255)`. Actually, you should forget about `varchar` with PostgreSQL and always use `text` (unless of course there is a real length constraint). – mu is too short Jun 17 '12 at 17:34
  • i am using the Java persistence api, how does the type text convert into that api, i am looking for the annotation that translates to that – Warz Jun 17 '12 at 17:40
  • I don't know JPA, that's why I'm just commenting to point you in the right direction. – mu is too short Jun 17 '12 at 18:06
  • There's no limit to varchar in PostgreSQL. You can use varchar() to store strings of any size. – Dondi Michael Stroma Jun 17 '12 at 20:45

1 Answers1

0

It turns out that i have to recreate all the tables for this effect to work @Lob declares the text type in postgresql.

Warz
  • 7,386
  • 14
  • 68
  • 120