Hello, everyone!
There's an issue that has been bothering me through the past few days. And I concluded that I can't handle it by myself. :) I need some assistance, please...
I've got an entity class that is called 'Call'. It represents some request made to my web service.
In a method I try to retrieve all calls that meet certain criteria, afterwards change their 'beingProcessed' field to true and merge them to DB. Finally I make a commit().
Unfortunatelly, the flush to the DB is never done. The entries in the DB never get 'beingProcessed' unless i build my Maven project again. I suppose the session interacts to some second level cache, although I've disabled it.
Here's my snippet of code:
Code:
public static List<Call> getPendingCalls() {
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();
List<Call> calls = session.createQuery(SELECT_PENDING_ASYNC_CALLS).list();
for (Call call : calls) {
call.setBeingProcessed(true);
session.merge(call);
}
session.close();
return calls;
}
Here is the SELECT_PENDING_ASYNC_CALLS string:
Code:
private static final String SELECT_PENDING_ASYNC_CALLS = "SELECT call FROM Call call WHERE call.pending = true AND call.beingProcessed = false AND call.type = '1'";
And here are the props that disable second level cache:
Code:
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<property name="cache.use_second_level_cache">false</property>
Any help will be greatly appreciated!
Best,
Martin