I have plugged in TreeCache in hibernate. To retrieve data from database i have coded -
Session s = SESSION_FACTORY.openSession();
Transaction txn = s.beginTransaction();
TTkopOper tTkopOper = (TTkopOper) session.get(TTkopOper.class, operId);
txn.commit();
When i try to retrieve the data from database, the TreeCache.put() method is called on every call to Session.get(). The local cache is updated prior to commiting the transaction whereas cache replication takes place when transaction is commited.
I have the following queries -
1. How is TreeCache notified when a transaction commits. Is it notified while transaction is commiting or after transaction has commited.
2. Is TreeCache performing cache replication in the current transaction or is initiating a separate transaction of its own.
3. If database commit fails, is local cache and cache replication rolled back.
|