-->
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: Help! Understanding Hibernate Caching..
PostPosted: Sat Jul 30, 2011 2:55 pm 
Newbie

Joined: Sat Jul 30, 2011 2:37 pm
Posts: 3
Hello Hibernate User..

I have two web application that is using the same Oracle 10g database. One application-A is able to update/save/delete "Messages" into a table. The other application-B is able to retrieve the "Messages" and display the content of this message into a webpage.

I have been struggling trying to setup application-B to retrieve updated "Messages" after application-A makes changes to the message. For example, application-A creates a new message that says "Message-1". application-B then goes to a page and it retrieves this "Message-1". Then application-A updates this message to "Message-2". application-B goes to that same page to retrieve the message, but the retrieval from the db is still showing that the message content is "Message-1"

Is this issue I'm having related to the way hibernate caches queries?

Any help would be reallly appreciate! really desperate to fix this issue :)

Here's my hibernate setting for application-B:
Code:
<property name="hibernateProperties">
   <value>
      hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
      hibernate.current_session_context_class=thread
      hibernate.id.new_generator_mappings=true
      hibernate.connection.release_mode=after_transaction
   </value>
</property>


Here's the code snippet trying to retrieve the "Message", *SiteDestination is the object that contains the message
Code:
   public List<SiteDestination> getSiteDestinationForNewLogin() throws RepositoryException {
      List<SiteDestination> result = null;
      try {
         sessionFactory.getCurrentSession().beginTransaction();
         
         result = sessionFactory.getCurrentSession().createQuery(
               "from SiteDestination as siteDestination where siteDestination.siteDestinationCode = ? or siteDestination.siteDestinationCode = ? or siteDestination.siteDestinationCode = ? or siteDestination.siteDestinationCode = ?")
               .setString(0, Constants.NEW_LOGINS_DISABLE)
               .setString(1, Constants.NEW_LOGINS_SESSIONS_DISABLE)
               .setString(2, Constants.REDIRECT_LOGIN_PAGE)
               .setString(3, Constants.REDIRECT_ERROR_PAGE)
               .setCacheable( false )
               .list();
      } catch (Exception ex) {
... exception handling code ..
      } finally {
         sessionFactory.evict(SiteDestination.class);
      }
      
      return result;
   }


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.