-->
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: Long raw as default data type on Oracle database server
PostPosted: Mon Mar 10, 2008 12:22 pm 
Newbie

Joined: Mon Mar 10, 2008 11:58 am
Posts: 1
We have a table that has more than one columns that should map to blob. The problems is that Hibernate tries to map all of this columns to 'long raw' on Oracle database server (10g) event if the server does not permit more than one column of type long raw in a table. I try to keep mapping as general as possible because the application has to work with MySQL, Oracle and MsSQL database servers without code modifications.

Here is the mapping I came up with:

Code:
<hibernate-mapping>
   <class
name="mypackage.MyClass"
      table="MYTABLE">
...

      <property name="privateKey" type="java.security.PrivateKey"
         column="PRIVATEKEY" length="50000" />
      <property name="publicKey" type="java.security.PublicKey"
         column="PUBLICKEY" length="50000" />
      <property name="certificate"
         type="java.security.cert.X509Certificate" column="CERTIFICATE"
         length="50000" />
...

   </class>
</hibernate-mapping>



I tried to specify blob as desired sql-type but the sql type's names are different on different database servers.

Is there any way to map this classes to blob on Oracle database servers without explicitly doing this with the sql-type attribute? The temporary solution we came up was changing

registerColumnType( Types.VARBINARY, "long raw" );

line in org.hibernate.dialect.Oracle9Dialect and org.hibernate.dialect.Oracle8iDialect with

registerColumnType( Types.VARBINARY, "blob" );

line. It seams to be working just fine, but the question is how could we map objects to columns in order to achieve object serialization without modifying hibernate's classes?

Thanks,
--Robert


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.