stat.setObject(6, m.getPayload());
stat.setObject(6, m);
   public void store(Message m) throws Throwable   {      Connection conn = ds.getConnection();      String sql = "INSERT INTO MESSAGES VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )";      PreparedStatement stat = conn.prepareStatement(sql);      stat.setString(1, (String)m.getMessageID());      stat.setBoolean(2, m.isReliable());      stat.setLong(3, m.getExpiration());      stat.setLong(4, m.getTimestamp());      stat.setObject(5, ((MessageSupport)m).getHeaders());      stat.setObject(6, m.getPayload());      int type = -1;      String jmsType = null;      int priority = -1;      Object correlationID = null;      boolean destIsQueue = false;      String dest = null;      boolean replyToIsQueue = false;      String replyTo = null;      Map jmsProperties = null;      if (m instanceof JBossMessage)      {         JBossMessage jbm = (JBossMessage)m;         type = jbm.getType();         jmsType = jbm.getJMSType();         priority = jbm.getJMSPriority();         // TODO TODO_CORRID         try         {         correlationID = jbm.getJMSCorrelationID();         }         catch(JMSException e)         {            // is this exception really supposed to be thrown?            correlationID = jbm.getJMSCorrelationIDAsBytes();         }         Destination d = jbm.getJMSDestination();         if (d != null)         {            destIsQueue = d instanceof Queue;            if (destIsQueue)            {               dest = ((Queue)d).getQueueName();            }            else            {               dest = ((Topic)d).getTopicName();            }         }         Destination r = jbm.getJMSReplyTo();         if (r != null)         {            replyToIsQueue = r instanceof Queue;            if (replyToIsQueue)            {               replyTo = ((Queue)r).getQueueName();            }            else            {               replyTo = ((Topic)r).getTopicName();            }         }         jmsProperties = jbm.getJMSProperties();      }      stat.setInt(7, type);      stat.setString(8, jmsType);      stat.setInt(9, priority);      stat.setObject(10, correlationID);      stat.setBoolean(11, destIsQueue);      stat.setString(12, dest);      stat.setBoolean(13, replyToIsQueue);      stat.setString(14, replyTo);      stat.setObject(15, jmsProperties);      stat.executeUpdate();      if (log.isTraceEnabled()) { log.trace(stat); }      conn.close();   }