fasth
fasth

Reputation: 2342

hsqldb hibernate persist @Lob

I'm trying to persist a long string to database (exception's stacktrace), we use HSQLDB (2.2.9) for tests and Postgre for runtime.

1) I annotated field like

@Lob
private String someBigMessage;

2) Wrote migration DDL script (flyway but no matter)

..., some_big_message text, ...

3) It migrates OK, but when I perform JUnit test, which uses hsqldb I'm getting this:

org.springframework.orm.jpa.JpaSystemException: org.hibernate.exception.GenericJDBCException: could not execute statement; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not execute statement
...
Caused by: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not execute statement
...
Caused by: org.hibernate.exception.GenericJDBCException: could not execute statement
...
Caused by: java.sql.SQLException: java.lang.RuntimeException: unsupported internal operation: Session java.lang.RuntimeException: unsupported internal operation: Session
...
Caused by: org.hsqldb.HsqlException: java.lang.RuntimeException: unsupported internal operation: Session

Any suggestions? Thanks.

Upvotes: 0

Views: 2154

Answers (1)

fasth
fasth

Reputation: 2342

I have migrated to 2.3.1, got error in a same place, but with more specific explanation:

HsqlException: data exception: string data, right truncation Then added annotation @Column:

@Lob
@Column(length=20971520)
private String someBigMessage;

Then migrated back to 2.2.9 and it works!

Upvotes: 4

Related Questions