Hi there,
I am new in orientdb and I need to implement *OSerializableStream*
interface in order to save objects in orientdb database. I use
*orientdb-community-1.7.4* version and tried to use *SerializationUtils* in
spring to serialize, deserialize the objects. When I want to serialize
objects with attribute *Map<Integer, Collection<String>>*, I get error
message:
java.lang.IllegalArgumentException: Failed to serialize object
*SocialRecord.java*
package persistence.graphdb.socialNetwork;
import com.orientechnologies.orient.core.exception.OSerializationException;
import com.orientechnologies.orient.core.serialization.OSerializableStream;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import org.springframework.util.SerializationUtils;
public class SocialRecord implements OSerializableStream{
// all message keywords
private Map<Integer, Collection<String>> keywords = new HashMap<>();
public Map<Integer, Collection<String>> getKeywords() {
return keywords;
}
public void setKeywords(Map<Integer, Collection<String>> keywords) {
this.keywords = keywords;
}
@Override
public byte[] toStream() throws OSerializationException {
return SerializationUtils.serialize(this);
}
@Override
public OSerializableStream fromStream(byte[] bytes) throws
OSerializationException {
return (OSerializableStream) SerializationUtils.deserialize(bytes);
}
}
When I create some objects of SocialRecord class and call *toStream()*
method, I get IllegalArgumentException.
stackoverflow
<http://stackoverflow.com/questions/29335676/illegalargumentexception-failed-to-serialize-object>
--
---
You received this message because you are subscribed to the Google Groups
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.