-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: session.merge() does not get flushed to DB
PostPosted: Thu Jul 22, 2010 4:16 am 
Newbie

Joined: Thu Jul 22, 2010 4:05 am
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.