首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >hsqldb hibernate持久化@Lob

hsqldb hibernate持久化@Lob
EN

Stack Overflow用户
提问于 2014-08-11 15:05:00
回答 1查看 2.1K关注 0票数 0

我试图将一个长字符串持久化到数据库(异常的堆栈跟踪),我们使用HSQLDB (2.2.9)进行测试,将Postgre用于运行时。

1)我注释的字段如下

代码语言:javascript
复制
@Lob
private String someBigMessage;

2)编写了迁移DDL脚本(天桥,但没关系)

代码语言:javascript
复制
..., some_big_message text, ...

3)它可以迁移,但是当我执行JUnit测试(它使用hsqldb )时,我得到了以下内容:

代码语言:javascript
复制
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

有什么建议吗?谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-10-22 18:23:46

我迁移到了2.3.1,在同一个地方得到了错误,但有更具体的解释:

HsqlException:数据异常:字符串数据,右截断,然后添加注释@列:

代码语言:javascript
复制
@Lob
@Column(length=20971520)
private String someBigMessage;

然后迁移回2.2.9,它就能工作了!

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25246451

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档