我有這樣的代碼問題基本屬性的java.sql.Blob
@Entity
@Table(name = "picture")
public class Picture implements Serializable {
@Id
@Column(name = "id")
@GeneratedValue
private int id;
@Column(name = "format", length = 8)
private String format;
@Basic(fetch = FetchType.LAZY)
@Column(name = "context", nullable = true, columnDefinition="mediumblob")
@Lob
private java.sql.Blob myBlobAttribute; // protected accessor and modifier
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "branch_fk", referencedColumnName = "id", nullable = false)
private Branch branch;
//Some setter and getter
我使用NetBeans 6.7,並在這個IDE它告訴我就行(private java.sql.Blob myBlobAttribute;)
但是代碼的運行錯誤,它使我的數據庫圖像表! 這是一個真正的錯誤還是隻是通知,我必須如何解決它? 錯誤信息是:
basic attributes can only be of the following types: java primitive types,wrapper of primitive types, String, java.math.bigInteger, java.math.BigDecimal, java,util.Date, java.util.Calendar, java.sql.Data, java.sql.TimeStamp, byte[], Byte[], char[], Character[], enums, or any Serializable type
'基本'屬性類型不應該是'Blob'(參見下面) – 2012-11-21 17:03:42