Somebody please tell me I am doing something really dumb and that this
explanation below is all wrong!
I have a CMP managed entity with some cmp fields, one of which is
java.lang.Object. After persisting a value in this field (it happens to be a
String) and bouncing jboss to make it re-load from the db, imagine my
surprise when I got back an instance of java.rmi.MarshalledObject.
I've looked at the code in org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand and
this is what I think is happening...
The method:
setParameter(PreparedStatement stmt,
int idx,
int jdbcType,
Object value)
determines this is a binary type and wraps it in a MashalledObject and
serializes it to a byte arry before writign that to the db.
The method:
getResultObject(ResultSet rs, int idx, Class destination)
Finds no special methods for retriving the destination type (which is
java.lang.Object in my case) and so calls rs.getObject(idx). The code...
if(destination.isAssignableFrom(result.getClass()))
return result;
then says is the result an instanec of my destination type (java.lang.Object)
which is always true in this case. hecne it doesn't do any unwrapping, etc.
Can someone see if this reasoning is right please?
I can think of 2 possible work arounds at present:
1) Declare my field as byte[] and serialize the supplied object to it myself
(I'm pretty sure the byte[] cmp management works?)
2) Declare the field as MyObject which just contains the real object. This
should fool the code into unwrapping MyObject and then I can extract the real
object from that.
I don't like either really.
Any help appreciated. Should I have posted this to the developers list?
Thanks, Matty.
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user