net.sf.hibernate.AssertionFailure: Exception releasing cache locks

Hibernate JIRA | Loren Rosen | 1 decade ago
  1. 0

    I'm getting the message "AssertionFailure - -An AssertionFailure occured - this may indicate a bug in Hibernate". Here's the situation: I have a class with read-only caching (<cache usage="read-only"/>. But I do not have mutable="false" for this class-- perhaps that doesn't make sense, but I thought I should at least report the problem I stumbled on while trying to run this setup, before I change my configuration. First, I create a new object (via new.... Session.save.... Transaction.commit). This does do the database insert (which perhaps it shouldn't do in this configuration). Next, in a new session with a new transaction, I take the same object, and delete it (via Session.delete.... Transaction.commit). This gets an exception on the commit, "java.lang.UnsupportedOperationException: Can't write to a readonly object", which is reasonable. Now the code goes to the exception handler, which naturally attempts to rollback the transaction. This raises another exception, with the "may indicate a bug message" : [DEBUG] JDBCTransaction - -rollback [ERROR] ReadOnlyCache - -Application attempted to edit read only item: 360449 [ERROR] AssertionFailure - -An AssertionFailure occured - this may indicate a bug in Hibernate <java.lang.UnsupportedOperationException: Can't write to a readonly object>java.lang.UnsupportedOperationException: Can't write to a readonly object at net.sf.hibernate.cache.ReadOnlyCache.release(ReadOnlyCache.java:47) at net.sf.hibernate.impl.ScheduledDeletion.afterTransactionCompletion(ScheduledDeletion.java:34) at net.sf.hibernate.impl.SessionImpl.afterTransactionCompletion(SessionImpl.java:530) at net.sf.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.java:90) at com.loren.DocumentExample.deleteTestDoc(DocumentExample.java:617) at com.loren.DocumentExample.main(DocumentExample.java:71) Exception in thread "main" net.sf.hibernate.AssertionFailure: Exception releasing cache locks at net.sf.hibernate.impl.SessionImpl.afterTransactionCompletion(SessionImpl.java:541) at net.sf.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.java:90) at com.loren.DocumentExample.deleteTestDoc(DocumentExample.java:617) at com.loren.DocumentExample.main(DocumentExample.java:71) Caused by: java.lang.UnsupportedOperationException: Can't write to a readonly object at net.sf.hibernate.cache.ReadOnlyCache.release(ReadOnlyCache.java:47) at net.sf.hibernate.impl.ScheduledDeletion.afterTransactionCompletion(ScheduledDeletion.java:34) at net.sf.hibernate.impl.SessionImpl.afterTransactionCompletion(SessionImpl.java:530) ... 3 more

    Hibernate JIRA | 1 decade ago | Loren Rosen
    net.sf.hibernate.AssertionFailure: Exception releasing cache locks
  2. 0

    I'm getting the message "AssertionFailure - -An AssertionFailure occured - this may indicate a bug in Hibernate". Here's the situation: I have a class with read-only caching (<cache usage="read-only"/>. But I do not have mutable="false" for this class-- perhaps that doesn't make sense, but I thought I should at least report the problem I stumbled on while trying to run this setup, before I change my configuration. First, I create a new object (via new.... Session.save.... Transaction.commit). This does do the database insert (which perhaps it shouldn't do in this configuration). Next, in a new session with a new transaction, I take the same object, and delete it (via Session.delete.... Transaction.commit). This gets an exception on the commit, "java.lang.UnsupportedOperationException: Can't write to a readonly object", which is reasonable. Now the code goes to the exception handler, which naturally attempts to rollback the transaction. This raises another exception, with the "may indicate a bug message" : [DEBUG] JDBCTransaction - -rollback [ERROR] ReadOnlyCache - -Application attempted to edit read only item: 360449 [ERROR] AssertionFailure - -An AssertionFailure occured - this may indicate a bug in Hibernate <java.lang.UnsupportedOperationException: Can't write to a readonly object>java.lang.UnsupportedOperationException: Can't write to a readonly object at net.sf.hibernate.cache.ReadOnlyCache.release(ReadOnlyCache.java:47) at net.sf.hibernate.impl.ScheduledDeletion.afterTransactionCompletion(ScheduledDeletion.java:34) at net.sf.hibernate.impl.SessionImpl.afterTransactionCompletion(SessionImpl.java:530) at net.sf.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.java:90) at com.loren.DocumentExample.deleteTestDoc(DocumentExample.java:617) at com.loren.DocumentExample.main(DocumentExample.java:71) Exception in thread "main" net.sf.hibernate.AssertionFailure: Exception releasing cache locks at net.sf.hibernate.impl.SessionImpl.afterTransactionCompletion(SessionImpl.java:541) at net.sf.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.java:90) at com.loren.DocumentExample.deleteTestDoc(DocumentExample.java:617) at com.loren.DocumentExample.main(DocumentExample.java:71) Caused by: java.lang.UnsupportedOperationException: Can't write to a readonly object at net.sf.hibernate.cache.ReadOnlyCache.release(ReadOnlyCache.java:47) at net.sf.hibernate.impl.ScheduledDeletion.afterTransactionCompletion(ScheduledDeletion.java:34) at net.sf.hibernate.impl.SessionImpl.afterTransactionCompletion(SessionImpl.java:530) ... 3 more

    Hibernate JIRA | 1 decade ago | Loren Rosen
    net.sf.hibernate.AssertionFailure: Exception releasing cache locks
  3. 0

    Can't write readonly object after hibernate upgrade

    Stack Overflow | 2 years ago | Marc
    java.lang.UnsupportedOperationException: Can't write to a readonly object
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Getting "Can't write to a readonly object" on an entity marked with "CacheConcurrencyStrategy.READ_WRITE"

    Stack Overflow | 8 months ago | Dave
    org.springframework.transaction.TransactionSystemException: Could not commit JPA transaction; nested exception is javax.persistence.RollbackException: Error while committing the transaction
  6. 0

    cannot update object with nonstrict-read-write

    Stack Overflow | 9 months ago | AJ14
    java.lang.UnsupportedOperationException: Can't write to a readonly object

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.UnsupportedOperationException

      Can't write to a readonly object

      at net.sf.hibernate.cache.ReadOnlyCache.release()
    2. net.sf.hibernate
      JDBCTransaction.rollback
      1. net.sf.hibernate.cache.ReadOnlyCache.release(ReadOnlyCache.java:47)
      2. net.sf.hibernate.impl.ScheduledDeletion.afterTransactionCompletion(ScheduledDeletion.java:34)
      3. net.sf.hibernate.impl.SessionImpl.afterTransactionCompletion(SessionImpl.java:530)
      4. net.sf.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.java:90)
      4 frames
    3. com.loren
      DocumentExample.main
      1. com.loren.DocumentExample.deleteTestDoc(DocumentExample.java:617)
      2. com.loren.DocumentExample.main(DocumentExample.java:71)
      2 frames