Simon Stewart wrote:

> On Wed, May 15, 2002 at 10:48:48PM -0500, Dain Sundstrom wrote:
> 
>>>I'm starting to suspect that JBoss might be the culprit here. If I
>>>manually extract an object from the byte array, it turns out to be a
>>>java.rmi.MarshalledObject when the expected class was java.lang.String.
>>>
>>>Can anyone shed some light on this? I'm using CMP 2, if that helps. 
>>>
>>JBossCMP stores objects in serialized form using a MarshalledObject.  I 
>>copied this code from JAWS, so I am not sure of the reasons.  I think it 
>>has something to do with portability of stored objects, but the real 
>>reason is it works.
>>
> 
> Agreed, storing Objects as MarshalledObjects is the Right Way to store
> things into the database so that they can be recovered, but that
> doesn't explain why when I store an Object via CMP, a byte array is
> returned on subsequent get()s. I can convert the byte array into an
> ObjectInputStream, pull out the MarshalledObject and then do a get()
> on that to restore the object, but that shouldn't be necessary.
> 
> For an interface like this:
> 
> public void setObject( String key, Object value );
> public Object getObject( key );
> 
> and then attempt to use it:
> 
> SomeEJB.setObject( "key", new URL( "http://www.foo.com"; ) );
> URL url = (URL) SomeEJB.getObject( "key" );
> 
> I should _not_ be getting a ClassCastException (from memory: this
> happened last night, and I've kludged a work-around using Strings)
> when I call get(), but that's exactly what happens!
> 
> I can extract the necessary bits from my code and send it to you as a
> simple test case if that would help....
> 


Before you do this, make sure it is not a DB or driver bug.  I 
specifically remember PostgreSQL having problems with URLs.  Try your 
code with hypersonic.

-dain




_______________________________________________________________

Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to