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.

link|improve this question
Show us your real code, and tell us the exact and complete error message, which probably contains meaningful information and is not just a "you did something wrong" flag. – JB Nizet 17 mins ago
feedback

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown

Browse other questions tagged or ask your own question.