Message:
A new issue has been created in JIRA.
---------------------------------------------------------------------
View the issue:
http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-611
Here is an overview of the issue:
---------------------------------------------------------------------
Key: HB-611
Summary: Session.load() retrieves different Object instances when String keys are used
Type: Bug
Status: Unassigned
Priority: Major
Project: Hibernate2
Assignee:
Reporter: Scott Russell
Created: Thu, 8 Jan 2004 11:59 PM
Updated: Thu, 8 Jan 2004 11:59 PM
Environment: HIbernate 2.1, Informix database
Description:
When using Session.load() to load an Object from the database that has a (whitespace-trimmed) string key, different Objects are returned from Parent-Child relationships, which load associated Objects using the full whitespace-padded string key.
I noticed this when loading an Child object using Session.load(), and then loading the Parent using Session.load(), and comparing the loaded child with the child in the Parent's collection of children. Although both the loaded Child and the collection-element child refer to the same database record, they exist in the session as different Objects because the former is referenced by its trimmed key, whereas the latter appears to be referenced by its full length key (ie. as loaded from the database column, padded with empty spaces). This causes countless problems, as one naturally expects that the same object would be used within the same session.
eg.
Child c1 = (Child) Session.load(Child.class, "A");
c1.setValue("a_value");
Parent p = (Parent) Session.load(Parent.class, "B");
Child c2 = p.getChild("A"); // returns null
Child c3 = p.getChild("A "); // returns expected child
c3.getValue(); // Returns original loaded value, not "a_value",
// as one would expect
---------------------------------------------------------------------
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
|