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数据库,请问为什么?

解决方案 »

  1.   

    可能有冲突  加file时报错吗??报什么错?
      

  2.   

    定义:file
    private String file;get() 方法
    @Lob
    @Basic(fetch = FetchType.EAGER)
    @Column(name="FILE", columnDefinition="BLOB", nullable=true)
    public String getFile() {
    return file;
    }
      

  3.   

    o 对了~!
    最好把file 改个其他的名字 file可能是Oracle的关键字
      

  4.   

    你好,非常感谢你的回答,在ORACLE下解决了,刚才的问题确实是由于file字段的问题,改为myfile就解决了,但在Sql Server2000下还是不能生成表
      

  5.   

    sql Server2000 中可能没有clob字段 
    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;