View Full Version : result serialization

12-13-2002, 05:34 AM
is Result serializable?
I'd like to send a Result through an ObjectOutputStream to be treated by a distant application(applet).
Interface serializable is not implemented in RolapResult but can we overide it ?

12-13-2002, 05:42 AM
You're welcome to make that change.
Another option to consider (preferable, I think) is serializing to XML; see src/main/mondrian/web/taglib/DOMBuilder.java. This produces XML, which we feed through XSL transforms to produce the various tables you see in taglib.jsp.

12-14-2002, 03:09 PM
Comments from Andreas Voss [avix]:
I don't think it's a good idea to use java serialization on the mondrian core classes (Result). The problem is, that java serialization serializes *everything* - so it will serialize the query, the built-in function table, the JDBC driver and everything else it can reach. You will have to bear this in mind when you change the system in the future, e.g. you will not be able to add a reference from the Result to the JDBC driver because the serialization may fail. Using the transient keyword here would be more like a hack, because the de-serialized Result will not be functional, so the Result pretends to be serializable but it is not.
Java serialization is ok, but I'd copy the result into a separate class hierarchy before serializing. After that, one could use XMLEncoder (java 1.4) too, its similar to java.io.Serializable but operates on java beans and uses XML as data format.
I would not use the DOMBuilder, because the XML can not easily converted back to java objects. Also I'd consider the web package(s) as deprecated, they will be replaced by JPivot soon.