o.h.engine.jdbc.spi.SqlExceptionHelper : ERROR: value too long for type character varying(10485760)


I am getting following error while storing data into postgre table.

2020-03-12 16:09:45.826  INFO 29394 --- [Thread-10] com.test.commons.CommonUtils        : total violations after applying filters
2020-03-12 16:09:46.219  WARN 29394 --- [Thread-10] o.h.engine.jdbc.spi.SqlExceptionHelper   : SQL Error: 0, SQLState: 22001
2020-03-12 16:09:46.219 ERROR 29394 --- [Thread-10] o.h.engine.jdbc.spi.SqlExceptionHelper   : ERROR: value too long for type character varying(10485760)
2020-03-12 16:09:46.220  INFO 29394 --- [Thread-10] o.h.e.j.b.internal.AbstractBatchImpl     : HHH000010: On release of batch it still contained JDBC statements

Following is my definition in code

 @Column(length=10485760)
 String result

1 Answer

5 years ago by

Looks like the data you are pushing is more than you defined. You can change the data type to TEXT in PostgreSQL, which gives you unlimited length.
Change your code to following

 @Lob
 String result
5 years ago by Karthik Divi