-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: How to use BLOB column with Oracle and PostgreSQL?
PostPosted: Mon Aug 12, 2013 10:48 am 
Newbie

Joined: Mon Aug 12, 2013 10:30 am
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.