-->
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: Disable query cache
PostPosted: Thu Nov 17, 2005 8:58 am 
Beginner
Beginner

Joined: Mon Oct 03, 2005 5:13 pm
Posts: 30
Hi all. I have an application that collects a collection of objects, and other that inserts elements in this collection. I want to refresh the items of this collection every time I consult these, while this other application inserts other items.

I tryed some stuff like these:

Code:
public static Session getSession() throws Exception {
        if(session == null) {
            SessionFactory sessionFactory = null;

           // Get the session factory we can use for persistence
           sessionFactory = getConfiguration().buildSessionFactory();
           sessionFactory.evictQueries();
           // Ask for a session using the JDBC information we've configured
           session = sessionFactory.openSession();
           session.setFlushMode(FlushMode.ALWAYS);
        }
        return session;

    }


and this:

Code:
public Query getQuery(MyQueryInstance myQueyInstance) throws Exception {
      Session aSession = MyHibernate.getSession();
      aSession.clear();
      Query aQuery = aSession.createQuery(myQueyInstance.getQueyStatement());
      //aQuery.setCacheable(false);
      //aQuery.setCacheMode(CacheMode.IGNORE);
      Hashtable aTab = myQueyInstance.getParameters();
      Enumeration aParListDefinition = aTab.keys();
      while(aParListDefinition.hasMoreElements()) {
         MYQueryParameter aParDef = (MyQueryParameter)aParListDefinition.nextElement();
         String aParName = aParDef.getName();
         Object aValue = aTab.get(aParDef);
         aQuery.setParameter(aParName , aValue);
      }
      return aQuery;
   }


I donĀ“t want to use cache, how to disable this? Or there is other better alternative?


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.