Hibernate JPA data type blob doesn’t work with the Sybase image data type. Below is a sample of the data type I’m using. Could someone tell me how to map fileContent to the Sybase image data type?
Sample code
@Column(length=100000)
private byte[] fileContent;
Exception
Caused by: org.hibernate.HibernateException: Wrong column type in DEV_eprs.dbo.pr_file_upload for column file_content. Found: image, expected: varbinary(100000)
When using @Lob, received the following exception when retrieving data.
java.lang.UnsupportedOperationException
The method com.sybase.jdbc3.jdbc.SybResultSet.getBlob(String) is not supported and should not be called.
I resolved this issue by creating a custom data type, below is the solution. Hope this helps others.
//Your entity
//Custom data type