-->
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.  [ 2 posts ] 
Author Message
 Post subject: Exception when using JBoss Cache with optimistic locking
PostPosted: Mon Mar 19, 2007 3:54 pm 
Newbie

Joined: Thu Mar 31, 2005 5:01 pm
Posts: 16
This continues a discussion on the JBoss Cache forum:
http://jboss.org/index.html?module=bb&o ... c&t=103983

Hibernate version:3.2.2

JBoss Cache version:1.4.1.SP2

Mapping:
Code:
@Entity
@Cache(usage=CacheConcurrencyStrategy.TRANSACTIONAL)
public class C {
   
   @Id
   int id;

}


Code between sessionFactory.openSession() and session.close() + a bit more:
Code:
         SessionFactory factory = new AnnotationConfiguration().configure().buildSessionFactory();
         TransactionManager txManager = DummyTransactionManager.getInstance();
         txManager.begin();
         Session session = factory.getCurrentSession();
         session.createQuery("update  C c set c.id = 1").executeUpdate();
         txManager.commit();


Full stack trace of any exception that occurs:
Code:
org.hibernate.cache.CacheException: org.jboss.cache.CacheException: Must be in a valid transaction _remove; id:5(null, /com/medq/test/C, true)
   at org.hibernate.cache.OptimisticTreeCache.clear(OptimisticTreeCache.java:169)
   at org.hibernate.cache.TransactionalCache.clear(TransactionalCache.java:124)
   at org.hibernate.impl.SessionFactoryImpl.evictEntity(SessionFactoryImpl.java:832)
   at org.hibernate.action.BulkOperationCleanupAction.evictEntityRegions(BulkOperationCleanupAction.java:132)
   at org.hibernate.action.BulkOperationCleanupAction.afterTransactionCompletion(BulkOperationCleanupAction.java:111)
   at org.hibernate.engine.ActionQueue.afterTransactionCompletion(ActionQueue.java:170)
   at org.hibernate.impl.SessionImpl.afterTransactionCompletion(SessionImpl.java:424)
   at org.hibernate.jdbc.JDBCContext.afterTransactionCompletion(JDBCContext.java:225)
   at org.hibernate.transaction.CacheSynchronization.afterCompletion(CacheSynchronization.java:85)
   at org.jboss.cache.transaction.DummyTransaction.notifyAfterCompletion(DummyTransaction.java:270)
   at org.jboss.cache.transaction.DummyTransaction.commit(DummyTransaction.java:64)
   at org.jboss.cache.transaction.DummyBaseTransactionManager.commit(DummyBaseTransactionManager.java:61)
   at com.medq.test.TestHibernate.main(TestHibernate.java:24)
Caused by: org.jboss.cache.CacheException: Must be in a valid transaction _remove; id:5(null, /com/medq/test/C, true)
   at org.jboss.cache.interceptors.OptimisticNodeInterceptor.invoke(OptimisticNodeInterceptor.java:66)
   at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
   at org.jboss.cache.interceptors.EvictionInterceptor.invoke(EvictionInterceptor.java:88)
   at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
   at org.jboss.cache.interceptors.OptimisticCreateIfNotExistsInterceptor.invoke(OptimisticCreateIfNotExistsInterceptor.java:69)
   at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
   at org.jboss.cache.interceptors.OptimisticValidatorInterceptor.invoke(OptimisticValidatorInterceptor.java:84)
   at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
   at org.jboss.cache.interceptors.OptimisticLockingInterceptor.invoke(OptimisticLockingInterceptor.java:126)
   at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
   at org.jboss.cache.interceptors.OptimisticReplicationInterceptor.invoke(OptimisticReplicationInterceptor.java:147)
   at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
   at org.jboss.cache.interceptors.TxInterceptor.handleNonTxMethod(TxInterceptor.java:365)
   at org.jboss.cache.interceptors.TxInterceptor.invoke(TxInterceptor.java:160)
   at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
   at org.jboss.cache.interceptors.CacheMgmtInterceptor.invoke(CacheMgmtInterceptor.java:183)
   at org.jboss.cache.TreeCache.invokeMethod(TreeCache.java:5776)
   at org.jboss.cache.TreeCache.remove(TreeCache.java:3855)
   at org.jboss.cache.TreeCache.remove(TreeCache.java:3438)
   at org.hibernate.cache.OptimisticTreeCache.clear(OptimisticTreeCache.java:166)
   ... 12 more



Name and version of the database you are using:
Affects all databases.

The generated SQL (show_sql=true):
Code:
Hibernate: update C set id=1


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 29, 2007 11:20 am 
Newbie

Joined: Tue Jul 11, 2006 6:14 am
Posts: 2
See http://opensource.atlassian.com/projects/hibernate/browse/HHH-2532

_________________
--
Manik Surtani
Lead, JBoss Cache
http://labs.jboss.com/jbosscache


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

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.