Date timestamp = new Date();//(2)
message.setDate(timestamp);
Query query = persister.newQuery();//(3)
query.setFilter("chat == " + message.getChat());
List<ChatRoom> chats = (List<ChatRoom>) query.execute();
ChatRoom chat = chats.get(0);//(4)
chat.updateLastMessageDate(timestamp);//(5)
} finally {
persister.close();
}
}