-->
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.  [ 1 post ] 
Author Message
 Post subject: Cache locking problem
PostPosted: Thu Jul 21, 2005 3:14 am 
Newbie

Joined: Wed May 25, 2005 11:03 am
Posts: 13
Hi all,

I am facing a problem with cache locking.

The code is as follows:

Inside "onUpdate" (Lifecycle) method, I open one more session and save different object to database. Then I close this new session and refresh current session. These two sessions are part of same transaction.

public boolean onUpdate(Session session) throws CallbackException {

SessionFactory sessionFactory = ServiceLocator
.getInstance().getHibernateSessionFactory();
Session newSession = sessionFactory.openSession(session
.connection());
newSession.saveOrUpdate(getEmbeddedObject());
newSession.flush();
newSession.close();
session.refresh(this);

return NO_VETO;
}

This new session is closed and current session proceeds with updating "this" entity. But if any error occurs while saving "this" entity, then the lock on cache node is not released.

Is this because of "newSession"?
and Is it safe to have two sessions in a single transaction??

Other specifications are:

Server used: Jboss 3.2.3
Hibernate Cache: TreeCache - transactional
Hibernate Version: 2.0
TransactionStrategy: net.sf.hibernate.transaction.JTATransactionFactory

Entries in Tree-cache.xml
IsolationLevel: REPEATABLE_READ
CacheMode: LOCAL

If anyone can point me to the resource locking in hibernate, that would be helpful.

Regards,
Reshma


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.