Shouldn't there be an order by messageid in this select statement?

Thanks
Celine

SELECT_MESSAGE = SELECT MESSAGEID, MESSAGEBLOB FROM JMS_MESSAGES WHERE 
MESSAGEID=? AND DESTINATION=?

public SpyMessage loadFromStorage(MessageReference messageRef) throws 
JMSException
   {
      if (log.isTraceEnabled())
         log.trace("Loading message from storage " + messageRef);

      TransactionManagerStrategy tms = new TransactionManagerStrategy();
      tms.startTX();
      Connection c = null;
      PreparedStatement stmt = null;
      ResultSet rs = null;
      boolean threadWasInterrupted = Thread.interrupted();
      try
      {
         c = this.getConnection();
         stmt = c.prepareStatement(SELECT_MESSAGE);
         stmt.setLong(1, messageRef.messageId);
         stmt.setString(2, messageRef.getPersistentKey());

         rs = stmt.executeQuery();
         if (rs.next())
            return extractMessage(rs, 2);

         return null;

      }
      catch (IOException e)
      {
         tms.setRollbackOnly();
         throw new SpyJMSException("Could not load message : " + messageRef, e);
      }
      catch (SQLException e)
      {
         tms.setRollbackOnly();
         throw new SpyJMSException("Could not load message : " + messageRef, e);
      }
      finally
      {
         try
         {
            rs.close();
         }
         catch (Throwable ignore)
         {
         }
         try
         {
            stmt.close();
         }
         catch (Throwable ignore)
         {
         }
         try
         {
            c.close();
         }
         catch (Throwable ignore)
         {
         }
         tms.endTX();

         // Restore the interrupted state of the thread
         if( threadWasInterrupted )
            Thread.currentThread().interrupt();
      }
   }

protected SpyMessage extractMessage(ResultSet rs, int column) throws 
SQLException, IOException
   {
      long messageid = rs.getLong(1);
      SpyMessage message = null;
      if (blobType == OBJECT_BLOB)
      {
         message = (SpyMessage) rs.getObject(column);
      }
      else if (blobType == BYTES_BLOB)
      {
         byte[] st = rs.getBytes(column);
         ByteArrayInputStream baip = new ByteArrayInputStream(st);
         ObjectInputStream ois = new ObjectInputStream(baip);
         message = SpyMessage.readMessage(ois);
      }
      else if (blobType == BINARYSTREAM_BLOB)
      {
         ObjectInputStream ois = new 
ObjectInputStream(rs.getBinaryStream(column));
         message = SpyMessage.readMessage(ois);
      }
      else if (blobType == BLOB_BLOB)
      {
         ObjectInputStream ois = new 
ObjectInputStream(rs.getBlob(column).getBinaryStream());
         message = SpyMessage.readMessage(ois);
      }
      message.header.messageId = messageid;      return message;
   }


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3899522#3899522

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3899522


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to