Message:
The following issue has been closed.
Resolver: Gavin King
Date: Mon, 29 Sep 2003 4:26 PM
This is correct and essential functionality. Hibernate guarantess transaction-scoped identity.
---------------------------------------------------------------------
View the issue:
http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-370
Here is an overview of the issue:
---------------------------------------------------------------------
Key: HB-370
Summary: load(Class, Serializable) behaves differently than load(Object, Serializable)
Type: Bug
Status: Closed
Priority: Minor
Resolution: REJECTED
Project: Hibernate2
Components:
core
Versions:
2.0.3
Assignee:
Reporter: Bernard Ligny
Created: Mon, 29 Sep 2003 9:20 AM
Updated: Mon, 29 Sep 2003 4:26 PM
Environment: Win Xp, JDK 1.4
Description:
I noticed two different behaviours depending on the fact that I am using the session.load() with an Object or a Class as first parameter.
The problem appears when trying to load more than once a same persistent instance in the same session:
Example 1: crash
=========
tx = session.beginTransaction();
Object obj1 = new MyObjectClass();
session.load(obj1, new Long(123));
Object obj2 = new MyObjectClass();
session.load(obj2, new Long(123));
...
=> throws an Hibernate Exception for 2nd load
("already an object with that id in session")
Example 2 : works perfectly !
=========
(the same code but using the other load signature)
tx = session.beginTransaction();
Object obj1 = session.load(MyObjectClass, new Long(123));
Object obj2 = session.load(MyObjectClass, new Long(123));
...
***
The annoying point is that the not-working example is the one in the "Root Persistent Class" design pattern:
public void refresh() throws HibernateException, SQLException {
HibernateSession.currentSession().load(this, _id);
}
---------------------------------------------------------------------
JIRA INFORMATION:
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
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
|