-
1. Re: Read JAVA_OBJECT from store
scoy Nov 13, 2002 7:07 PM (in response to crowleym)With the caveat that I have not looked at the 2.4 source, JBoss versions prior to 3.0.4 used their own marshalling/demarshalling scheme for jdbc JAVA_OBJECT types. I would not be surprised if the 2.x series did the same.
In order the recover the object, you'll need to inspect the 2.4 source and find out how it was stored.
Note that there are clear semantics in the JDBC docs for using using JAVA_OBJECT, which JBoss previously ignored. You probably should be using one of the BINARY jdbc type variants unless you know what what you're doing.
Steve -
2. Re: Read JAVA_OBJECT from store
crowleym Nov 14, 2002 6:03 AM (in response to crowleym)Found it. For anyone interested...
Any object stored is wrapped as a java.rmi.MarshalledObject
So you need to do the following:
ResultSet rs = .....
ByteArrayInputStream bis = new ByteArrayInputStream(rs.getBytes(...));
ObjectInputStream ois = new ObjectInputStream(bis);
Object o = ((MarshalledObject) ois.readObject()).get();
ois.close();
You can then cast 'o' to your specific object type. -
3. Re: Read JAVA_OBJECT from store
crowleym Nov 14, 2002 6:06 AM (in response to crowleym)Found it. For anyone interested...
Any object stored is wrapped as a java.rmi.MarshalledObject
So you need to do the following:
ResultSet rs = .....
ByteArrayInputStream bis = new ByteArrayInputStream(rs.getBytes(...));
ObjectInputStream ois = new ObjectInputStream(bis);
Object o = ((MarshalledObject) ois.readObject()).get();
ois.close();
You can then cast 'o' to your specific object type.