java.lang.UnsupportedOperationException: Can't write to a readonly object>java.lang.UnsupportedOperationException: Can't write to a readonly object

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • 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
    via by Loren Rosen,
  • 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
    via by Loren Rosen,
    • 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)
    No Bugmate found.