title: FlexJson Error : ClassCastException: java.util.HashMap cannot be cast to class
body: <p>This is the error I get while I try to cast my LONGTEXT object from mysql back to my ProcessInputs java object using FlexJSON.</p>
  
  <pre><code>java.lang.ClassCastException: java.util.HashMap cannot be cast to org.juzzy.server.ProcessInputs
      at org.juzzy.server.FLSDAO.RetrieveFLSFromDatabase(FLSDAO.java:68)
      at org.juzzy.client.CreateFLS.doPost(CreateFLS.java:48)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:745)
  </code></pre>
  
  <p>This is what my ProcessInput class looks like</p>
  
  <pre><code>public class ProcessInputs {
  //inputs contain names of all the inputs and their objects
      Map&lt;String,Input&gt; inputs= new LinkedHashMap&lt;String,Input&gt;();
      Map&lt;String,Output&gt; outputs= new HashMap&lt;String,Output&gt;();
      Map&lt;String,Object&gt; fuzzyTerms=new HashMap&lt;String,Object&gt;();
      Map&lt;String,String&gt; fuzzyTermMapper=new HashMap&lt;String,String&gt;();
      ArrayList&lt;T1_Antecedent&gt; antecedentArrayList;
      String outputxml;
      T1_Rulebase  rulebase = new T1_Rulebase(1);
  //getters,setters, constructor and functions
  }
  </code></pre>
  
  <p>My retrieval code in FLEXJSON:</p>
  
  <pre><code>while(rs.next()){
          String jsonInString= rs.getString("fls");
          JSONDeserializer&lt;ProcessInputs&gt; der = new JSONDeserializer&lt;ProcessInputs&gt;();
          ProcessInputs fls = der.deserialize(jsonInString);
  
      }
  </code></pre>
  
  <p>This is how the serialization happens:</p>
  
  <pre><code>public boolean InsertFLStoDatabase(ProcessInputs object, String xml) throws IOException {
      Connection connection = DatabaseConnect.getConnection();
      String query = "insert into fls_systems (fls, xml) values (?,?)";
      try { 
          JSONSerializer ser = new JSONSerializer();
          String jsonInString = ser.deepSerialize(object);
          PreparedStatement ps = connection.prepareStatement(query);
          ps.setString(1, jsonInString);
  </code></pre>