views:

157

answers:

1

Hi, I am working on a cache replication solution between nodes

Node A - master node => Hibernate + Database + Ehcache as secondary cache
Node B - regional node=> Ehcache as prmiary cache. no Hibernate

Node B is used only as near-by cache for query.

Now I am updating data (Say SudentInfo) in Node A, it gets persisted and cached correctly. On replication side (I am using JMS) it sends a message to Node B. But the problem is, the message it sends is of instance CacheEntry(deep Inside Element), there is no way to resurrect the original object (StudentInfo). What I got in node B is CacheEntry with some attributes of Students but not actually an Student Object.

Please note that I don't need Hibernate session/persistence in Node B, node B is only for fast query, persistence is done through Node A. So has anybody tried any solution like this? Is there any way to convert CacheEntry to actual object? or Tell ehcache to replicate original object rather than CacheEntry.

Thanks for the help

A: 

What does "Ehcache as secondary cache" mean? As a second level cache?

Because if that's the case, then the object that is replicated is not an object, it's the data that Hibernate uses to store the object, it's essentially equivalent to the row level data stored in your database.

Take a look at this article, it explains what's in the second level cache: Truly Understanding the Hibernate Second-Level cache and Query cache

My question to you would be - why not configure node B to talk to the database - then you have a homogoneous setup. If caching happens to be working - then great you get cached values and don't hit the DB - and if not you hit the DB.

Unless there is some topological reason you can't do this - it would be a lot easier in my opinion to just run both nodes with the same configuration/setup.

Taylor Gautier