4
我想知道什麼是圖像存儲與休眠(到MySQL)的幫助下,我有這個類的映射存儲和由Hibernate
@Entity
@Table(name = "picture")
public class PictureEntity implements Serializable {
@Id
@Column(name = "id")
@GeneratedValue
private int id;
@Column(name = "format", length = 8)
private String format;
//@Basic(fetch = FetchType.LAZY)
@Lob
@Column(name = "context", nullable = true, columnDefinition = "mediumblob")
private java.sql.Blob myBlobAttribute; // or byte[] no diff
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "branch_fk", referencedColumnName = "id", nullable = false)
private BranchEntity branch;
也是最好的辦法 ,我有PictureDAO檢索圖像;我想知道如何實現我的PictureDAO來保存和檢索圖像。
設置/獲取myBlobAttribute值不會這樣做嗎?你有哪些錯誤?你有什麼嘗試? em.persist(entity),em.find(entity,id) – 2009-07-25 05:45:42