Reputation: 1869
I have a spring application that uses MySQL as database.
I want to migrate the application from MySQL to Postgres, and it seems that I can not declare byte[] array:
I have this column:
@Type(type="org.hibernate.type.BinaryType")
private byte[] data.
I get this error:
Caused by: org.postgresql.util.PSQLException: ERROR: type "tinyblob" does not exist
Is there a way to achive this in PostgreSQL?
Upvotes: 7
Views: 20783
Reputation: 1245
In your PostgreSQL DB Table, set the data
column datatype to bytea
NOT bytea[]
and in your POJO class:
@Column(name="name_of_your_column")
private byte[] data;
Leave out the @Type(type="org.hibernate.type.BinaryType")
annotation.
That should work just fine.
Upvotes: 8