I've changed variable SELECT_ACTIVE_CONVERSATIONS to:
public static final String SELECT_ACTIVE_CONVERSATIONS = "SELECT DISTINCT "+ | ||
"ofConversation.conversationID,"+ | ||
"ofConversation.room,"+ | ||
"ofConversation.startDate,"+ | ||
"ofConParticipant.bareJID,"+ | ||
"ofMessageArchive.fromJID,"+ | ||
"ofMessageArchive.toJID"+ | ||
" FROM ofConversation (nolock) INNER JOIN ofConParticipant (nolock) ON ofConversation.conversationID = ofConParticipant.conversationID"+ |
" INNER JOIN ofMessageArchive (nolock) ON ofConParticipant.conversationID = ofMessageArchive.conversationID WHERE ofConversation.lastActivity > ";
and code to:
pstmt = con.prepareStatement(SELECT_ACTIVE_CONVERSATIONS+Long.toString(now - conversationTimeout * 60L * 1000L));
//pstmt.setLong(1, now - conversationTimeout * 60L * 1000L); //COMMENTED
This is a very dirty hack but it works for me.