-->
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: Session.setReadOnly throws TransientObjectException
PostPosted: Tue Jan 10, 2006 2:51 pm 
Regular
Regular

Joined: Sat Nov 19, 2005 2:46 pm
Posts: 69
Hibernate version: 3.1
Seeing as setReadOnly(Object, boolean) is a brand new method for Hibernate 3.1, I was wondering if this was my own mis-use of it, or if it's a bug. The objects passed into the method are very definitely associated with the session.

Thank you for your interest,

Relevent code snippet between sessionFactory.openSession() and session.close():
Code:
      if(readOnly)
      {
        Class clazz = persistable.getClass();
        if(clazz.getName().contains("EnhancerByCGLIB"))
        {
          clazz = clazz.getSuperclass();
        }
        persistable = (Persistable) session.get(clazz, persistable.getIdentifier());
      }
      else
      {
        persistable = (Persistable) session.merge(persistable);
      }

      logger.debug("session.contains(" + persistable + ") -> " + session.contains(persistable));
      // This method is Hibernate 3.1 only
      session.setReadOnly(persistable, readOnly);



Full stack trace of any exception that occurs:
Code:
DEBUG:eg.persistence.HibernatePersister.bind(HibernatePersister.java:106) session.contains(Workflow[@d92304] -> true
DEBUG:eg.persistence.HibernatePersister.bind(HibernatePersister.java:106) session.contains(BusinessDTO@136daec) -> true
DEBUG:eg.persistence.HibernatePersister.bind(HibernatePersister.java:106) session.contains(Company@26c3a1) -> true
ERROR:eg.web.PersistenceFilter.doFilter(PersistenceFilter.java:63) Instance was not associated with the session
org.hibernate.TransientObjectException: Instance was not associated with the session
   at org.hibernate.engine.StatefulPersistenceContext.setReadOnly(StatefulPersistenceContext.java:1167)
   at org.hibernate.impl.SessionImpl.setReadOnly(SessionImpl.java:1740)
   at eg.persistence.HibernatePersister.bind(HibernatePersister.java:108)

_________________
Stewart
London, UK


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 10, 2006 4:24 pm 
Regular
Regular

Joined: Sat Nov 19, 2005 2:46 pm
Posts: 69
I have reported this as a bug under key HHH-1352
http://opensource.atlassian.com/project ... e/HHH-1352

_________________
Stewart
London, UK


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.