From: <leg...@at...> - 2003-11-06 13:46:14
|
The following comment has been added to this issue: Author: Matjaz Smolej Created: Thu, 6 Nov 2003 7:45 AM Body: One other thing: this worked in beta 4, haven't checked with beta 5. --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-460 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-460 Summary: Collection sort order bug when using cache Type: Bug Status: Unassigned Priority: Major Project: Hibernate2 Assignee: Reporter: Matjaz Smolej Created: Thu, 6 Nov 2003 7:28 AM Updated: Thu, 6 Nov 2003 7:28 AM Description: I am using Hibernate 2.1 beta 6. I have a collection property mapped as: <set name="partyRoleSet" lazy="true" inverse="true" cascade="all" sort="natural" > <jcs-cache usage="read-write" /> <key column="Party_ID" /> <one-to-many class="entity.PartyRoleEntity" /> </set> The natural sort order is specified and read-write caching is enabled. When reading a collection mapped this way for the first time, the sort order is correct, however, on the next read, the elements are not properly sorted. Here is the snapshot of the debug info for the same collection before and after caching: First read: m_partyRoleSet= net.sf.hibernate.collection.SortedSet (id=16050) additions= null collectionSnapshot= net.sf.hibernate.impl.SessionImpl$CollectionEntry (id=16062) currentKey= null currentPersister= null dirty= false dorecreate= false doremove= false doupdate= false initialized= true loadedKey= java.lang.Long (id=16036) loadedPersister= net.sf.hibernate.collection.OneToManyPersister (id=16073) processed= false reached= false role= "entity.PartyEntity.partyRoleSet" snapshot= java.util.HashMap (id=16075) comparator= null directlyAccessible= false initialized= true session= net.sf.hibernate.impl.SessionImpl (id=16065) set= java.util.TreeSet (id=16066) keySet= java.util.TreeMap$1 (id=16071) m= java.util.TreeMap (id=16072) tempList= null Second read: m_partyRoleSet= net.sf.hibernate.collection.Set (id=16097) additions= null collectionSnapshot= net.sf.hibernate.impl.SessionImpl$CollectionEntry (id=16105) currentKey= null currentPersister= null dirty= false dorecreate= false doremove= false doupdate= false initialized= true loadedKey= java.lang.Long (id=16090) loadedPersister= net.sf.hibernate.collection.OneToManyPersister (id=16073) processed= false reached= false role= "entity.PartyEntity.partyRoleSet" snapshot= java.util.HashMap (id=16108) directlyAccessible= false initialized= true session= net.sf.hibernate.impl.SessionImpl (id=16106) set= java.util.HashSet (id=16107) map= java.util.HashMap (id=16109) tempList= null Note that the collection type changed from SortedSet to Set. It seems like sorted collections are not cached or retrieved in a proper way. --------------------------------------------------------------------- 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 |