[hibernate-issues] [Hibernate-JIRA] Created: (HBX-973) ClassCastException: hbm2java generates HashSet instead of TreeSet when <set .... sort="MySorter"> is defined.

Bill Mair (JIRA) noreply at atlassian.com
Sun Aug 19 07:34:13 EDT 2007


ClassCastException: hbm2java generates HashSet instead of TreeSet when <set .... sort="MySorter"> is defined.
-------------------------------------------------------------------------------------------------------------

                 Key: HBX-973
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-973
             Project: Hibernate Tools
          Issue Type: Bug
          Components: hbm2java
    Affects Versions: 3.2beta8
         Environment: Hibernate Tools 3.2.0.beta8
Derby
            Reporter: Bill Mair


Mapping:

  <class name="CharSkillGroup">
  	<composite-id>
  		<key-many-to-one name="charRecord" class="CharRecord"  >
  			<column name="characterId" not-null="true" />
  		</key-many-to-one>
  		<key-many-to-one name="skillGroup" class="SkillGroup"  >
  			<column name="skillGroupId" not-null="true" />
  		</key-many-to-one>
  	</composite-id>

	<set name="skills" inverse="true" lazy="false" cascade="all" sort="eveapi.CharSkillSorter">
		<key>
			<column name="characterId"/>
			<column name="skillGroupId"/>
		</key>
		<one-to-many class="CharSkill"/>
	</set>

  </class>


Generates:

	private Set<CharSkill> skills = new HashSet<CharSkill>(0);

instead of

	private Set<CharSkill> skills = new TreeSet<CharSkill>();

This causes a class cast exception when persisting.

-- 
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
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list