- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
紧随this example ,我正在上传一个小文件并尝试存储到 postgresql bytea 列中。
这是错误(前两个输出是在尝试 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;
}
最佳答案
对我来说,它在 Postgres 数据库中使用 bytea
类型。
@Lob
@Type(type="org.hibernate.type.BinaryType")
@Column(name = "photo")
private byte[] photo;
//and get and set
关于postgresql - seam 文件上传到 postgres bytea 列 "column is bytea but expression is of type bigint",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9114510/
我是一名优秀的程序员,十分优秀!