I want to store image into database using hibernate. i am using postgres database
i tried "bytea" data type to store image and "byte[]" data type in hibernate pojo.
i used following code,
Query
CREATE TABLE photo ( "photo_name" bytea ) WITH (OIDS=FALSE); ALTER TABLE photo OWNER TO postgres;
Hibernate Pojo
public class PhotoEntity {
byte[] name;
public byte[] getName() {
return name;
}
public void setName(byte[] name) {
this.name = name;
}
}
but it gives error at time of mapping.
please give me any reference to do this.
Thank's in advance.