-->
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.  [ 3 posts ] 
Author Message
 Post subject: Implement 2nd level Caching in Hibernate Using JPA annotaion
PostPosted: Tue Jan 03, 2012 7:05 am 
Newbie

Joined: Sun Mar 20, 2011 2:36 am
Posts: 7
Hello,

I have a query in usage of 2nd Level Caching mechanism(provider : Eh-Cache) for hibernate 3.0.

I am using JPA 2.0 interface to connect to hibernate 3.0 and implement back end functionality.

My Query is that how can I cache Data Base tables in JPA 2.0 using Annotations..

Eg: For table A.. We configure in the A.hbm.xml file the following code of line
<cache usage=”read-only” /> .. to tell Hibernate to Cache the data of this Respective Table.


In JPA 2.0 , How can i Tell Hibernate using the JPA annotations/interfaces to Cache a database Table(Entities of the table).


I am aware of the Annotation..
@Cache.. in hibernate
to tell it to cache a table.. How can we acheive the same thing in JPA 2.0

Will this Annotation.. @Cachable... be usefull in JPA 2.0 to cache(2nd Level) a particular table Data?

Thanks And Regards.


Kindly let me know if my above query is unclear if if more information is required from my part.


Top
 Profile  
 
 Post subject: Re: Implement 2nd level Caching in Hibernate Using JPA annotaion
PostPosted: Thu Jan 05, 2012 4:56 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
Maybe this link can help you

http://stackoverflow.com/questions/3663979/how-to-use-jpa2s-cacheable-instead-of-hibernates-cache


Top
 Profile  
 
 Post subject: Re: Implement 2nd level Caching in Hibernate Using JPA annotaion
PostPosted: Mon Jan 09, 2012 6:48 am 
Newbie

Joined: Sun Mar 20, 2011 2:36 am
Posts: 7
pb00067 wrote:



I was able to configure 2nd level Caching using Hibernate Annotations in my entity pojo java files.

My Requirement was :

My database tables are only ready only tables for reference purpose for teh first time when the user logs in . I don't want them to be changed by any user while he is updating the persistent entity objects through the provided user interfaces...

That is, the data is fetched and stored into entity classes only for the 1st time by hitting the database ,when the user logs in for the first time..
After that, there after, what ever changes the user does, to that data, it should be only updated in the cache.. and not in the database table......

Is it possible to achieve through Hibernate or any other ORM tool??????

Also , Is it possible to use any Cache Provider API's to obtain the above desired result.??????


KINDLY GUIDE.!!
THANKS.!!!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.