How to add an Element to the SecondLevel Cache thru Hibernate?
Suresh Neeli Setty
posted 10 years ago
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, cache.put();
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.