【发布时间】:2012-02-25 05:40:09
【问题描述】:
紧跟this example,我正在上传一个小文件并尝试存储到postgresql bytea 列中。
这是错误(前两个输出是在尝试 INSERT 之前输出 bean 属性的日志语句:
SAGE 1 -- action.registration.LetterTemplateHome - 内容类型:text/xml
SAGE 1 -- action.registration.LetterTemplateHome - letterTemplateText: [B@48c7aaef
SAGE 1 -- action.registration.LetterTemplateHome - 内容为字符串:xml version="1.0" encoding="UTF-8" Standalone="yes" .... 等
SAGE 1 -- org.hibernate.util.JDBCExceptionReporter - 批处理条目 0 插入 letter_template(content_type、file_name_template、fileSize、letter_template_name、letter_template_text、letter_template_id)值('text/xml'、'letterDate.xml'、'0 ', 'yu', '37078', '202') 被中止。调用 getNextException 查看原因。
SAGE 1 -- org.hibernate.util.JDBCExceptionReporter - 错误:列“letter_template_text”是 bytea 类型,但表达式是 bigint 类型 提示:您将需要重写或强制转换表达式。 位置:162
这是在 bean 中定义字段的方式:
private byte[] letterTemplateText;
@Lob
@Column(name = "letter_template_text")
@Basic(fetch = FetchType.LAZY)
public byte[] getLetterTemplateText() {
return this.letterTemplateText;
}
public void setLetterTemplateText(byte[] letterTemplateText) {
this.letterTemplateText = letterTemplateText;
}
【问题讨论】:
标签: postgresql seam