I have mapped a table with a lot of colums to an Object. For use in statistics i invented a "LightObject" version, with only a few colums and cached it read-only.
Then i tried following code:
Code:
List result = session.find( "select o from LightObject as o left join o.entries as oe WHERE oe.someInformation is not null" );
for( Iterator it = result.iterator(); it.hasNext(); )
{
LightObject lo = (LightObject it.next();
Object ob = ObjectDAO.getInstance().load( lo.getId() );
ob.setSomeFlag( 1 );
ObjectDAO.getInstance().saveOrUpdate( order );
}
2004-11-19 10:17:09,092 ERROR [main] (ReadOnlyCache.java:35) - Application attempted to edit read only item: 948
java.lang.UnsupportedOperationException: Can't write to a readonly object
at net.sf.hibernate.cache.ReadOnlyCache.lock(ReadOnlyCache.java:36)
at net.sf.hibernate.impl.ScheduledUpdate.execute(ScheduledUpdate.java:50)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2382)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2336)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2204)
at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
at ........