-->
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: Problem with Blob field
PostPosted: Tue May 02, 2006 1:54 am 
Newbie

Joined: Tue May 02, 2006 12:59 am
Posts: 3
Location: hyderabad
Hi all,

While i am trying to insert a blob field using hibernate, I am getting this exception

Code:
java.lang.UnsupportedOperationException: Blob may not be manipulated from creating session


Here is my code..

Code:
Session sess = HibernateUtil.getSessionFactory().openSession();
      byte[] data = getParamByteData(); //Here i am getting byte array for blob field
      Parameters params = new Parameters("Test", data);
      Transaction transaction = null;
      try {
         transaction = sess.beginTransaction();
         sess.save(params);
         transaction.commit();
      } catch (Exception e) {
         e.printStackTrace();
         //System.out.println("Select exception in DM : " + e);
      }


Parameters.java

Code:
public class Parameters {
   
   private int paramId;
   
   private String paramName;
   
   private byte []paramFile;

   public Parameters(String paramName, byte[] paramFile) {
.
.
..


parameters.hbm.xml


Code:
<hibernate-mapping>
   <class name="com.test.blob.db.Parameters" table="parameters">
      <id name="paramId" column="param_id" type="int">
         <generator class="increment"/>
      </id>
      <property name="paramName">
         <column name="param_name" sql-type="string"/>
      </property>
      <property name="paramFile" column="param_file" type="com.test.blob.db.BinaryBlobType"/>   
   </class>
</hibernate-mapping>


Could any body help me out...

_________________
Thanks & Regards,
Venkata Phanikumar. G,
Hyderabad.


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.