Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Second Level Caching Problem in Hibernate  RSS feed

Suresh Neeli Setty
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am having an Object of type "Event". One property in that class is "Event_Id". When I save an object "newEvent" using session in Hibernate, the "newEvent" object is adding to the Second level cache using,

Here I am not calling the put(). But whenever an object is saved using Hibernate session, Hibernate SessionFactory takes care of SecondLevelCaching i.e., it is instantiating a new Element() and that element is getting added to the Cache. The element is taking the "Id" value as the Element Key and some version information as Element Value (defaultly).

Here what I wants is, when an Element is getting added to the Cache, the Element Value should not be Version information. It should be my "Event" object. Is it possible to make like this?

Is there any other way to do this?

Why I am trying to change this Element is, when an Element is added to the Cache, using the EventListeners, I wants to Index this Object which I can get using Element.getObjectValue().

Here my "Event" class is serializable.

I am killing time for this for the last couple of days.
Any suggestions are welcome.


Suresh Setty N
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!