PostgreSQL bytea and oid
I came across with following issue when i'm trying to save the uploaded file in to the database as a byte array using hibernate, JPA 2.0 annotation with Postgre SQL. even though in this stage i'm pretty much new to Postgre SQL, It has two type of data types to represent the binary data or BLOB, since i'm using hibernate jpa annotations use the annotation @Lob to indicate the byte[] of data to persist as a binary data. @Lob @Basic(fetch = FetchType.LAZY) public byte[] getPicture() { return picture; } exception : java.sql.SQLException: ERROR: column "picture" is of type bytea but expression is of type oid Then i understood the issue with the data types.but when the hibernate generating the table it creates the column with data type "oid" , after removing this annotation it creates a table column with "bytea" data type. and i'm in doubt which would be the most suitable data type to use. Then i found the difference...
Comments