Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   HIBERNATE, ORACLE, BLOB > 4k (http://www.velocityreviews.com/forums/t147067-hibernate-oracle-blob-4k.html)

chomiq 10-20-2005 11:11 AM

HIBERNATE, ORACLE, BLOB > 4k
 
How to put blob ( > 4k ) into Oracle9 using Hiberanete?

I got problem with inserting BLOB > 4k into Oracle database.

Example from http://www.hibernate.org/56.html do not works.

I use Tomcata5.5, Hibernate2.1.7, Oracle9, Java 1.5.

This line in my code:
( (oracle.sql.BLOB)atta.getData() ).putBytes(0,temp);

throws ClassCastException , why??

Is any other way to insert Blob into Oracle?

Do I have to use some other driver then oracle.thin ?
My context.xml looks like:

<Resource
name="jdbc/test"
auth="Container"
type="javax.sql.DataSource"
username="migration"
password="***"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@123.123.123.123:2222:TEST"
maxActive="100"
maxIdle="10"
maxWait="3000"
/>


Code is:

session = HibetnateUtil.currentSession();
tx = sessison.beginTransaction();
....
atta.setData( Hibernate.createBlob("temporary".getBytes()) );
session.save(atta);
session.flush();
byte[] temp = atta.getBytes();
session.refresh( atta, LockMode.UPGRADE );
( (oracle.sql.BLOB)atta.getData() ).putBytes(0,temp);
tx.commit();
session.flush();


Adam Maass 10-21-2005 02:56 AM

Re: HIBERNATE, ORACLE, BLOB > 4k
 

"chomiq" <k2stas@poczta.onet.pl> wrote:
>
> How to put blob ( > 4k ) into Oracle9 using Hiberanete?
>


Please google before posting questions that have obvious answers at obvious
places.

To save you the effort:

http://www.hibernate.org/56.html


Now, a slightly longer answer:

Oracle LOBs do not behave in the way that the authors of the SQL spec or the
JDBC spec expect. Oracle, to their credit, does a decent job of documenting
what you must do to make LOBs work in Oracle. Note that you will be spinning
a lot of custom code just for Oracle to use Oracle LOB types.


-- Adam Maass




All times are GMT. The time now is 08:55 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57