[hibernate-issues] [Hibernate-JIRA] Closed: (HHH-1133) Comparators, defined for collections in mapping files, are not set

Steve Ebersole (JIRA) noreply at atlassian.com
Mon Mar 21 13:00:46 EDT 2011


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1133?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Steve Ebersole closed HHH-1133.
-------------------------------


Closing stale resolved issues

> Comparators, defined for collections in mapping files, are not set
> ------------------------------------------------------------------
>
>                 Key: HHH-1133
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1133
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.1 rc2
>            Reporter: Richard HALLIER
>            Assignee: Steve Ebersole
>             Fix For: 3.1
>
>
> Example :
> 		<set name="items" inverse="true" sort="com.ItemComparator">
> 			<key column="x_id"/>
> 			<one-to-many class="com.Item"/>
> 		</set>
> Hibernate doesn't initialize correctly the sorted set, the comparator is not set.
> I think it comes from the following method of the Collection class :
> public Comparator getComparator() {
> 		if(comparator!=null && comparatorClassName!=null) {
> 			try {
> 				setComparator( (Comparator) ReflectHelper.classForName(
> 					comparatorClassName ).newInstance() );
> 			}
> 			catch (Exception e) {
> 				throw new MappingException( "Could not instantiate comparator class: "
> 					+ comparatorClassName + " for collection " + getRole()  );
> 			}
> 		}
> 		return comparator;
> 	}
> It obviously should be :
> 		if(comparator==null && comparatorClassName!=null) {
> Richard.

-- 
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