-->
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.  [ 6 posts ] 
Author Message
 Post subject: setBytes() or setBinaryStream() with blobs
PostPosted: Fri Jan 07, 2005 11:04 am 
Beginner
Beginner

Joined: Tue Oct 19, 2004 11:04 am
Posts: 22
Long explanation for a critical question:

I was recently browsing the documentation for the weblogic-cmp-jar.xml Deployment Descriptor Reference for Weblogic8.1 and came across something that could wreck my entire Hibernate based implementation. Here is the document:

[url]http://e-docs.bea.com/wls/docs81/ejb/DDreference-cmp-jar.html#1113301
[/url]

I am using several IMAGE columns within Sybase (which are akin to Blobs in Oracle). The above document states that the deployment descriptor for entity beans can include a dbms-column-type that specifies how Weblogic should set IMAGE column data. For sybase it says to use:

Quote:
SybaseBinary—tells the container to use setBytes to write bytes into the binary column, because setBinaryStream does not work with SybaseXADriver.


setBytes and setBinaryStream are methods of java.sql.PreparedStatement.

Although in development we are not using an XA driver, we are planning to in our production environment.

So my question is: Does Hibernate use setBinaryStream or setBytes to store binary column data?


Hibernate version:2.1.6


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 07, 2005 11:08 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Just have a look at the source for the type you are using (this is Open Source, you know). If you need to, you can always use a custom UserType.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 07, 2005 11:16 am 
Beginner
Beginner

Joined: Tue Oct 19, 2004 11:04 am
Posts: 22
Yes, I understand that Hibernate is open source. However, I have my own job to do and was hoping that someone with some knowledge of how the Hibernate code is put together could make an effort to answer my question. I don't have time to try to swallow a mound of code like this every time I have a question about how it works (and I am not alone).

If nothing else, could you give a description of the Hibernate architecture and where I should look in the source?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 07, 2005 11:35 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
If you have your own job to do, and can't afford some time to solve your problems, you should probably consider paid support ...

As I said, look at the type you are using in your mapping, if its binary, check net.sf.hibernate.BinaryType where your problem is configurable by setting the global property hibernate.jdbc.use_streams_for_binary


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 07, 2005 11:45 am 
Beginner
Beginner

Joined: Tue Oct 19, 2004 11:04 am
Posts: 22
Thank you. That's all I needed in the first place. I was not aware that that env setting existed.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 07, 2005 12:09 pm 
Beginner
Beginner

Joined: Tue Oct 19, 2004 11:04 am
Posts: 22
Just an FYI for the general populace:

After looking at the source, the 'hibernate.jdbc.use_streams_for_binary' defaults to 'false' and the setBytes method of PreparedStatement will be used by default....so I had nothing to worry about!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.