]
Steve Ebersole commented on HHH-1352:
-------------------------------------
Oops, the "patch" part of the comment comes from linked HHH-2501...
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: