我想知道在hibernate(进入MySQL)的帮助下存储图像的最佳方法是什么我有这个类映射
@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;我想知道我应该如何实现 My PictureDAO 来保存和检索图像。