package com.xc.pojo;import java.io.Serializable;
import java.sql.Blob;import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Lob;
import org.hibernate.annotations.TypeDef;
import org.hibernate.annotations.TypeDefs;
@Entity(name="BASE_COMMFILE")
public class Base_CommFile{
private int id;
private String filetype;
private int fileid;
private String type;
private String opid;
private Blob file;
private String filename;
private String suffix;
@Id
@GeneratedValue
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
@Column(name="filetype",length=3,nullable=true)
public String getFiletype() {
return filetype;
}
public void setFiletype(String filetype) {
this.filetype = filetype;
}
@Column(name="fileid",length=4,nullable=true)
public int getFileid() {
return fileid;
}
public void setFileid(int fileid) {
this.fileid = fileid;
}
@Column(name="type",length=3,nullable=true)
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Column(name="opid",length=32,nullable=true)
public String getOpid() {
return opid;
}
public void setOpid(String opid) {
this.opid = opid;
}
@Lob //对应Blob字段类型
public Blob getFile() {
return file;
}
public void setFile(Blob file) {
this.file = file;
}
@Column(name="filename",length=64,nullable=true)
public String getFilename() {
return filename;
}
public void setFilename(String filename) {
this.filename = filename;
}
@Column(name="suffix",length=32,nullable=true)
public String getSuffix() {
return suffix;
}
public void setSuffix(String suffix) {
this.suffix = suffix;
}
}
private Blob file; 有了这个字段后这个类对应的表生成不了,去掉类型为Blob的file地段,这个类对应的表就能自动生成,我用的是oracle数据库,请问为什么?
import java.sql.Blob;import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Lob;
import org.hibernate.annotations.TypeDef;
import org.hibernate.annotations.TypeDefs;
@Entity(name="BASE_COMMFILE")
public class Base_CommFile{
private int id;
private String filetype;
private int fileid;
private String type;
private String opid;
private Blob file;
private String filename;
private String suffix;
@Id
@GeneratedValue
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
@Column(name="filetype",length=3,nullable=true)
public String getFiletype() {
return filetype;
}
public void setFiletype(String filetype) {
this.filetype = filetype;
}
@Column(name="fileid",length=4,nullable=true)
public int getFileid() {
return fileid;
}
public void setFileid(int fileid) {
this.fileid = fileid;
}
@Column(name="type",length=3,nullable=true)
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Column(name="opid",length=32,nullable=true)
public String getOpid() {
return opid;
}
public void setOpid(String opid) {
this.opid = opid;
}
@Lob //对应Blob字段类型
public Blob getFile() {
return file;
}
public void setFile(Blob file) {
this.file = file;
}
@Column(name="filename",length=64,nullable=true)
public String getFilename() {
return filename;
}
public void setFilename(String filename) {
this.filename = filename;
}
@Column(name="suffix",length=32,nullable=true)
public String getSuffix() {
return suffix;
}
public void setSuffix(String suffix) {
this.suffix = suffix;
}
}
private Blob file; 有了这个字段后这个类对应的表生成不了,去掉类型为Blob的file地段,这个类对应的表就能自动生成,我用的是oracle数据库,请问为什么?
解决方案 »
- struts2处理结果返回页面(action)刷新提示重新提交,地址栏回车出现500错误。
- 一段urlrewrite的内容,哪位高人给翻译一下。
- 关于Hibernate两个表非主键关联后的数据更新问题?
- 急急急,bbs小项目报个action: null错误解决不了
- 数据操作高手来
- 急!如何在jsp页面实现动态显示
- 菜鸟哭了,数据库链接问题
- ExtJS 同一个页面下 有两个table 如果通过table中ID的不同获得该Table
- Struts 、谁会啊
- 求Eclipse+easy struts开发步骤
- 如何把一个struts.xml文件分成两个,我用的是s2sh框架
- EL request.getParameter
private String file;get() 方法
@Lob
@Basic(fetch = FetchType.EAGER)
@Column(name="FILE", columnDefinition="BLOB", nullable=true)
public String getFile() {
return file;
}
最好把file 改个其他的名字 file可能是Oracle的关键字
sql Server2000 我没用过,但是在Mysql中是用text,不知道sql2000是用什么
如果是用Mysql的话
就改成如下形式:
private String file; get() 方法
//@Lob
//@Basic(fetch = FetchType.EAGER)
//@Column(name="FILE", columnDefinition="BLOB", nullable=true)
@Column(name="FILE")
public String getFile() {
return file;
}