简体   繁体   中英

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.

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM