}
while (iter.hasNext())
{
// We may need to persist the message itself
MessageReference ref = (MessageReference) iter.next();
// For non reliable refs we insert the ref (and maybe the
// message) itself
// Now store the reference
log.trace("Paged ref with page order " + ref.getPagingOrder());
addReference(channelID, ref, psInsertReference, page);
int rows = psInsertReference.executeUpdate();
if (trace)
{
log.trace("Inserted " + rows + " rows");
}
// Maybe we need to persist the message itself
Message m = ref.getMessage();
rows = storeMessage(m, psInsertMessage, psUpdateMessage);
if (trace)
{