Bugs item #573828, was opened at 2002-06-25 21:33
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=573828&group_id=22866

Category: JBossCMP
Group: v2.4 (stable)
Status: Open
Resolution: None
Priority: 5
Submitted By: Markus Kling (mkling)
Assigned to: Nobody/Anonymous (nobody)
Summary: CMP, byte[] and Statement.getObject(...)

Initial Comment:
Hi,

Szenario: JBoss 2.4.6 & DB2 > 7.1.

I got some serious problems with CMP and JDBC 
Drivers that return other objects than expected for 
Statement.getObject(...).

My problem is that I got an entity bean with an instance 
field of the type byte[] which can be stored but not 
loaded again. The problem is that byte[] it is not a 
primitive type nore on of its object representations. In 
this situation the JDBCCommand executes the 
Stmt.getObject() in order to read the apropriate data. 
But getObject() does not return a byte[], as expected, it 
returns an instance of java.sql.Blob.

In this situation the JDBCCommand assumes that it 
must unmarshall the byte[] representation of the 
returned object. But the result is neither a Handle nor a 
primitive and this results in the "Unable to load a 
ResultSet column .." Exception. [see line#383 --> 
Object getResultObject(ResultSet rs, int idx, Class 
destination)]

Another problem was, that I had to provide an explizit 
jaws-mapping from byte[] to an sql type. DB2 does not 
support the JAVA_OBJECT sqltype. This results in an 
error (i don't remember it, sorry) if the JDBCCommand 
tries to use PreparedStatemen.setNull(....). 

<mapping>
        <java-type>[B</java-type>
        <jdbc-type>BLOB</jdbc-type>
        <sql-type>BLOB(1M)</sql-type>
</mapping>    

I am not sure if I missed something so I don't attached a 
FIX. Would It be possible to include a mapping for the 
array-types in the JDBCCOmmand? In this way it would 
be possible to use these getXX methods for all well 
known types.

This problems also affect version 3 and above!

Thanks for your help,
 Markus


----------------------------------------------------------------------

>Comment By: Markus Kling (mkling)
Date: 2002-07-15 10:26

Message:
Logged In: YES 
user_id=360804

Hi I had a look in the HEAD and saw that a suitable 
workarround was inserted in the JDBCCommand (current is 
v1.4.3).

Would it be possible to make this fix for Version 2.4.x too?
 
...
        } else if (destination.getName().equals("[B")) {
           return bytes;
...


--------------------------
Hi crippendsl, sorry but your answer has another scope than 
my question.

thanks
 Markus

----------------------------------------------------------------------

Comment By: Christian Schulte (crippendsl)
Date: 2002-07-11 11:58

Message:
Logged In: YES 
user_id=229917

Hello,

I also had trouble with byte[] in JBoss 2.4.4 but with MySQL
which I could fix and they were related to the DB and not to
jboss. I played a bit with your patch and just wanted to
post my experiences here:

First:

If I add your mapping

<mapping>
<java-type>[B</java-type>
<jdbc-type>BLOB</jdbc-type>
<sql-type>BLOB(1M)</sql-type>
</mapping>

to my jaws.xml file, byte[] types are even though
interpreted as JAVA_OBJECT and the mapping gets totally ignored.

Second:
I think your problem is related to your db or jdbc-driver
and not to jboss ?

I could store byte[] as BLOBS but was not able to read them
back. I got it working with another SQL-Type-Mapping for
MySQL. In MySQL the Type BLOB is only about 80kBytes, I
think, and if I use the type LONGBLOB in the mappings,
everythink works without your patch. MySQL just cutted the
end of my data because the data  was to big for SQL-Type
BLOB ! It took my hours of research (including compiling
JBoss with your Patch) and then it was just such a stupid
mistake I made!

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=573828&group_id=22866


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to