I could serialize SDO DataObject whose type meta-data stored in a NotDefault 
context. 
But when I unserialize it from inputStream, a "type not find" exception will 
raised because default Context is choosed
So Is there any way that I could choice the context or target while reading 
DataObject from inputStream ?

HelperContext scope = SDOUtil.createHelperContext(); //a No Default Context
scope.getXSDHelper().define(...) //define type from xsd in the scope

DataObject origin = scope.getDataFactory().create(...) //create then initialize 
a do
do.set(...)

ByteArrayOutputStream bos = new ByteArrayOutputStream(bos);
ObjectOutputStream out = new ObjectOutputStream(bos);
out.writeObject(do)
out.close();

ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
/*
following, a "cannot found type" Exception caused. As by default, it can only 
read type from default Scope
So could I choise the scope when I reading object from InputStream ???
*/
DataObject do = (DataObject)new ObjectInputStream(bis).readObject(); 

 

Reply via email to