hibernate oracle11g blob java.sql.SQLRecoverableException
我在通过hibernate获取blob字段的时候报错了。
类中属性字段注解如下:
@Column(name = "CONTENT1")
@NotNull
private java.sql.Blob content;
读取信息的方法如下:
byte[] bytes = getByte(attachment.getContent().getBinaryStream());
response.getOutputStream().write(bytes);
报错信息如下:
java.sql.SQLRecoverableException: 关闭的连接hibernate oracle11g java blob
at oracle.sql.BLOB.getDBAccess(BLOB.java:1071)
at oracle.sql.BLOB.getBinaryStream(BLOB.java:248)
[解决办法]
你读取blob字段的时候连接关闭了。
如果想从blob字段中读取数据,还是需要数据库连接的。
配置lazy="false"。试试!