-->
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: Issue with Second Level Cache
PostPosted: Mon Jun 10, 2013 7:08 am 
Newbie

Joined: Mon Jun 10, 2013 5:46 am
Posts: 1
Dear Guys,
Plz help in second level cache issue .
Below i m giving my code snippet for reference,
problem : With below code every(2nd and 3rd) time also hibernate queries are generating in console. So I m in confusing that Second level cache is working or not.

    Transaction Manager Bean :
    <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"
    p:sessionFactory-ref="sessionFactory" />
    Hibernate Cfg File:

    <hibernate-configuration>
    <session-factory>
    <property name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
    <property name="show_sql">true</property>
    <property name="hbm2ddl.auto">update</property>
    <property name="hibernate.cache.use_second_level_cache">true</property>
    <property name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
    <property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
    <property name="hibernate.cache.use_query_cache">true</property>
    </session-factory>
    </hibernate-configuration>

    pom file dependency :
    <dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-ehcache</artifactId>
    <version>4.1.0.Final</version>
    </dependency>

Domain Entity :
Code:
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.springframework.cache.annotation.Cacheable;

@Entity
@Table(name = "ONTRAC_KPI_TRIGGER_EVENTS")
@Cacheable(value = "kpiTriggerEvents")
@Cache(usage =  CacheConcurrencyStrategy.TRANSACTIONAL)
public class KpiTriggerEvents extends CommonFields implements Serializable {
........................................
}//end of class


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.