[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-1352) Session.setReadOnly(Object, boolean) fails for proxies

Bob Tiernay (JIRA) noreply at atlassian.com
Wed Aug 19 19:24:15 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1352?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=33825#action_33825 ] 

Bob Tiernay commented on HHH-1352:
----------------------------------

What isn't accounting for proxies, is there a workaround, and is this intended to be fixed?

Thanks

> Session.setReadOnly(Object, boolean) fails for proxies
> ------------------------------------------------------
>
>                 Key: HHH-1352
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1352
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.1
>         Environment: Hibernate 3.1, MySQL 5.0.15-nt
>            Reporter: Stewart Cambridge
>            Assignee: Steve Ebersole
>            Priority: Minor
>   Original Estimate: 1 day
>  Remaining Estimate: 1 day
>
> Session.setReadOnly(Object, boolean) is broken. It throws a TransientObjectException with the message "Instance was not associated with the session" when the object is quite obvious associated with the current session, because we only just loaded it using Session.load(Class, Serializable)
> Here is a simple JUnit test, for an arbitrary entity:
>   public void testReadOnly()
>     throws Exception
>   {
>     User user = (User) session.load(User.class, new Long(7));
>     System.out.println("\n=== " + user + " ===");
>     session.setReadOnly(user, true);
>   }
> This is the exception stack trace:
> 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
> test.persistence.HibernateObjectTest.testReadOnly(HibernateObjectTest.java:30) ....

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list