How is a blob column annotated in Hibernate?

quinn picture quinn · Jun 2, 2009 · Viewed 54.6k times · Source

How is a blob column annotated in Hibernate? So far I have a class that has:

@Column( name = "FILEIMAGE" )
private byte[ ] fileimage ;
//
public byte[ ] getFileimage ( ) { return this.fileimage ; }
public void setFilename ( String filename ) { this.filename = filename ; }

Answer

HeDinges picture HeDinges · Jun 2, 2009

@Lob should do the trick for blob and clob (use String as type)

@Column( name = "FILEIMAGE" )
@Lob(type = LobType.BLOB)
private byte[] fileimage;