From: <leg...@at...> - 2003-10-31 19:38:13
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-444 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-444 Summary: Session.load(Object, Serializable) does not load non-null collection properties Type: Bug Status: Unassigned Priority: Major Project: Hibernate2 Components: core Versions: 2.1 beta 5 Assignee: Reporter: Paul Ferraro Created: Fri, 31 Oct 2003 1:38 PM Updated: Fri, 31 Oct 2003 1:38 PM Description: Given the following persistent class: public class MyObject { private Integer id; private Set otherObjectSet = new HashSet(); public Integer getId() { return id; } public void setId(Integer id) { this.id = id } public Set getOtherObjectSet() { return otherObjectSet; } public void setOtherObjectSet(Set set) { otherObjectSet = set } } with the following mapping: <class name="MyObject" table="my_object" dynamic-update="true"> <id name="id" column="my_object_id" type="int"> <generator class="native"/> </id> <set name="otherObjectSet" table="my_object_mapping" cascade="none"> <key column="my_object_id"/> <many-to-many class="OtherObject" column="other_object_id"/> </set> </class> The following code misbehaves: Integer id = new Integer(1); MyObject object = new MyObject(); // otherObjectSet is initialized to empty set session.load(object, id); object.getOtherObjectSet() // Will always be empty - collection was not loaded however, Integer id = new Integer(1); MyObject object = (MyObject) session.load(MyObject.class, id); object.getOtherObjectSet() // Will return properly associated OtherObjects If I remove the " = new HashSet()" from the property declaration of set, then both methods return the proper values for getOtherObjectSet(). --------------------------------------------------------------------- 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 |