Hi,
I have a Java EE 6 application (with JBoss EAP 6.1, Hibernate 4.2.0) that should be portable between Oracle and PostgreSQL. But I cannot figure out how to do it with BLOB columns. Everything I tried only works with one database but not with both.
The column is defined as BLOB in Oracle and bytea in PostgreSQL. In the JPA entity class, the column definition is:
Code:
@Lob
@Column(name = "CONTENT")
private byte[] content;
When the application is started with PostgreSQL, Hibernate validates the database schema and shows this error message:
Code:
Caused by: org.hibernate.HibernateException: Wrong column type in schema.table_name for column CONTENT. Found: bytea, expected: oid
When I remove the @Lob annotation, it works in PostgreSQL, but with Oracle I get this message:
Code:
Caused by: org.hibernate.HibernateException: Wrong column type in SCHEMA.TABLE_NAME for column CONTENT. Found: blob, expected: raw(255)
I don't want to use the column types "oid" or "raw". Is there any solution for this dilemma? I found several JIRA issues with similar problems, but without a solution. Most issues were related to Hibernate 3.5/3.6 and some comments said that LOB support would be improved in 4.x. But I cannot see these improvements.
Thanks for your help!
Stephan