-->
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.  [ 5 posts ] 
Author Message
 Post subject: Disabling cache question
PostPosted: Thu Nov 13, 2008 2:44 pm 
Newbie

Joined: Fri Jul 18, 2008 8:53 pm
Posts: 6
I'm working on a web based application which will access a database that will be replicated between 2 masters, and possibly some slaves. In addition to the updates from replication, there are other applications that will read and update the data. For these reasons, I want to make sure the query and second level caches are disabled. How can I make sure of that?

I'm not finding anything clear in the documentation as to how to do that, and it looks like the defaults may have changed over time, so I'm a little suspicious of forum postings.

Thanks for any assistance!

Hibernate component versions:
hibernate-core: 3.3.0.sp1
hibernate-annotations: 3.4.0.GA
hibernate-commons-annotations: 3.1.0.ga
ejb3-persistence: 1.0.2.GA
hibernate-entitymanager: 3.3.2.GA


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 13, 2008 3:54 pm 
Newbie

Joined: Thu Nov 13, 2008 3:25 pm
Posts: 5
Wouldn't this work:

hibernate.cache.use_query_cache=false
hibernate.cache.use_second_level_cache=false


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 13, 2008 4:31 pm 
Newbie

Joined: Fri Jul 18, 2008 8:53 pm
Posts: 6
Yes, that seems like it will do it. I had a hard time finding the documentation for this for some reason. Thanks!

Now to figure out how to get Spring to pass this along for me, and prove that it is working.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 13, 2008 4:47 pm 
Newbie

Joined: Thu Nov 13, 2008 3:25 pm
Posts: 5
Something like this

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">

--- MAPPING RESOURCES HERE ----

<property name="dataSource" ref="dataSource" />

<property name="hibernateProperties">
<props>

<prop key="hibernate.cache.use_query_cache">false</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>


--- OTHER PROPERTIES ---

</props>
</property>
</bean>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 14, 2008 12:28 pm 
Newbie

Joined: Fri Jul 18, 2008 8:53 pm
Posts: 6
Thanks again. Since I'm using JPA, it's looking more like this:

Code:
  <bean id="entityManagerFactory"
    class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="jpaVendorAdapter">
      <bean
        class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
        <property name="database" value="MYSQL" />
        <property name="showSql" value="true" />
      </bean>
    </property>
    <property name="jpaPropertyMap">
      <map>
        <entry key="hibernate.cache.use_second_level_cache" value="false" />
        <entry key="hibernate.cache.use_query_cache" value="false" />
      </map>
    </property>
  </bean>


Seems to work in that if I put in invalid values things break.


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

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.