title: Problem in Converting a Object to Blob object
body: <p>I have a serialized object which needs to be converted to 'blob' object and store into Database. Previously we used to store an object which is defined by other project objects but doest follow rules of serialization because of which it ran into numerous problems and so we decided to change the structure 'blob' object which now contains only primitive objects only(String,boolean,Integer etc). So far we could make all attribute expect two.</p>
  
  <pre><code>private byte[] encode(ScheduledReport schedSTDReport)
  {
      byte[] bytes = null;
      try
      {
          ByteArrayOutputStream bos = new ByteArrayOutputStream(); 
          ObjectOutputStream oos = new ObjectOutputStream(bos);
          oos.writeObject(schedSTDReport);
          oos.flush(); 
          oos.close(); 
          bos.close();
          //byte [] data = bos.toByteArray();
          //ByteArrayOutputStream baos = new ByteArrayOutputStream();
          //GZIPOutputStream out = new GZIPOutputStream(baos);
          //XMLEncoder encoder = new XMLEncoder(out);
          //encoder.writeObject(schedSTDReport);
          //encoder.close();
          bytes = bos.toByteArray();
          //GZIPOutputStream out = new GZIPOutputStream(bos);
          //out.write(bytes);
          //bytes = bos.toByteArray();
  
      }
  </code></pre>
  
  <p>The above is writing blob
  Blob contains</p>
  
  <pre><code>public class ScheduledReport extends ScheduledReportInfo implements Serializable {
  
  
  
      private SupervisoryScope                   _scope          = null;
      private Report                             _attributes     = null;
      private ScheduledReportScheduleBase        _schedule       = null;
      private HashMap                            selectionList   = new HashMap();
      private EmailInfo                          _emailInfo      = null;
      private String                             _pdfFileName    = null;
      private short                              _baseDateOffset = -1;       
  </code></pre>
  
  <p>In the report object there are follwoing attribute</p>
  
  <pre><code>private String     deflt = null;
  private Object     guiValue = null;
  protected Object   serverValue = null;
  </code></pre>
  
  <p>The variable Object can have any like array list,string,boolean or a class object.
  But once decode to actual object it needs to type cast to whatever type it is.Our objective is to convert this object into any of primitive type and store and while retrieving back as original value. Essentially we thought every object as string with type of object append to it like '1_integer' ,'Y_Boolean' and convert to blob and while reviving split string and use the string as part of reflection to get the type of object for casting.  But this not feasible or correct solution. Any ideas.</p>