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