这是错误(前两个输出是在尝试INSERT之前输出bean属性的日志语句:
SAGE 1 — action.registration.LetterTemplateHome – content type: text/xml
SAGE 1 — action.registration.LetterTemplateHome – letterTemplateText: [B@48c7aaef
SAGE 1 — action.registration.LetterTemplateHome – contents as String: xml version=”1.0″ encoding=”UTF-8″ standalone=”yes” …. etc
SAGE 1 — org.hibernate.util.JDBCExceptionReporter – Batch entry 0 insert into letter_template (content_type,file_name_template,fileSize,letter_template_name,letter_template_text,letter_template_id) values (‘text/xml’,‘letterDate.xml’,‘0’,‘yu’,‘37078’,‘202’) was aborted. Call getNextException to see the cause.
SAGE 1 — org.hibernate.util.JDBCExceptionReporter – ERROR: column “letter_template_text” is of type bytea but expression is of type bigint
Hint: You will need to rewrite or cast the expression.
Position: 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; }
如果您想坚持使用bytea列(这在sql端使用起来相当简单),请使用BinaryType映射列.见:proper hibernate annotation for byte[]
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。