[hibernate-issues] [Hibernate-JIRA] Created: (HHH-2629) Enable ordering by association paths
Jörg Heinicke (JIRA)
noreply at atlassian.com
Tue May 22 15:25:04 EDT 2007
Enable ordering by association paths
------------------------------------
Key: HHH-2629
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2629
Project: Hibernate3
Issue Type: Patch
Components: query-criteria
Affects Versions: 3.2.4.sp1
Reporter: Jörg Heinicke
In Hibernate's criteria API ordering is not possible on association properties without explicitly creating aliases.
This also only works on one level, not recursively as it would be needed in the following example.
Criteria criteria = session.createCriteria(Account.class);
Criteria pCriteria = criteria.createCriteria("person");
pCriteria.add(Example.create(person));
pCriteria.createCriteria("company");
criteria.addOrder(Order.asc("person.company.name"));
return criteria.list();
I have changed CriteriaQueryTranslator in a way that it first searches the aliasCriteriaMap, second the associationPathCriteriaMap. And the key used for the search is no longer
StringHelper.root( propertyName );
but
StringHelper.qualifier( propertyName );
>From what I understand this can't break anything since it has always only worked with one '.' in the path. For those cases the key stays the same.
This implementation is still not perfect since
1. you need to create criteria in advance
2. you can't switch between alias and actual association path. The best would probably be to walk the path recursively.
--
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