-->
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.  [ 3 posts ] 
Author Message
 Post subject: Oracle Blob
PostPosted: Tue Jun 01, 2004 4:08 pm 
Newbie

Joined: Tue Jun 01, 2004 4:01 pm
Posts: 3
I read the Wiki article at

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

and modified the code accordingly. Here is the code snippet

hibernate.cfg.xml file
Code:
<property
           name="attachmentContent"
         type="java.sql.Blob"
         column="ATTACHMENT_CONTENT" 
         not-null="false"     
    />


Calling Code:
Code:
File file = new File(FILE_NAME);      
      FileInputStream in = new FileInputStream(file);
      attament.setAttachmentContent(Hibernate.createBlob(in));


But I get the following error
Code:
ERROR [Jun 01 2004 03:05:51 PM] [JDBCExceptionReporter]  (logExceptions) - No more data to read from socket
ERROR [Jun 01 2004 03:05:52 PM] [JDBCExceptionReporter]  (logExceptions) - No more data to read from socket
ERROR [Jun 01 2004 03:05:52 PM] [JDBCExceptionReporter]  (logExceptions) - No more data to read from socket
ERROR [Jun 01 2004 03:05:52 PM] [JDBCException]  (<init>) - could not insert: [org.ifmc.email.EmailAttachment#1]
java.sql.SQLException: No more data to read from socket
   at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
   at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
   at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:1160)
   at oracle.jdbc.ttc7.MAREngine.unmarshalUB1(MAREngine.java:963)
   at oracle.jdbc.ttc7.MAREngine.unmarshalSB1(MAREngine.java:893)
   at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:375)


If I use the file less than 4000, it works fine as expected. I use Oracle 9.X.

Thanks for your help
Osoe


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 01, 2004 5:44 pm 
Newbie

Joined: Tue Jun 01, 2004 4:01 pm
Posts: 3
This is the second block of code from the WIKI page
Code:
s = sf.openSession();
tx = s.beginTransaction();
foo = new Foo();
foo.setClob( Hibernate.createClob(" ") );
s.save(foo);
s.flush();
s.refresh(foo, LockMode.UPGRADE); //grabs an Oracle CLOB
oracle.sql.CLOB clob = (oracle.sql.CLOB) foo.getClob();
java.io.Writer pw = clob.getCharacterOutputStream();
pw.write([color=red]content[/color]);
pw.close();
tx.commit();
s.close();



I pass the inputstream to Hibernate.createClob() and where does the 'content' come from.

Osoe


Top
 Profile  
 
 Post subject: Need Help
PostPosted: Wed Jun 02, 2004 8:55 am 
Newbie

Joined: Tue Jun 01, 2004 4:01 pm
Posts: 3
Please I need some help.

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

I am trying making the BLOB work the similar way mentioned in the above URL for CLOB.

But Hibernate.createBlob() does not take a String. Also I could not understand where does the content come from. Could any one post the example for BLOB.

Thanks
Osoe


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

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.