Changeset 3777
- Timestamp:
- Sep 25, 2007, 11:35:01 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.4-stable/src/core/net/sf/basedb/core/ItemContext.java
r3679 r3777 898 898 // Tempoarary storage for all associations that must be left joined 899 899 Set<String> leftJoins = autoLeftJoin ? new HashSet<String>() : null; 900 Set<String> sortedProperties = autoLeftJoin ? new HashSet<String>() : null; 900 901 901 902 // Add sort order information … … 930 931 if (dotIndex >= 0) 931 932 { 932 leftJoins.add(sortProperty.substring(0, dotIndex)); 933 String toJoin = sortProperty.substring(0, dotIndex); 934 leftJoins.add(toJoin); 935 sortedProperties.add(toJoin); 933 936 } 934 937 } … … 995 998 { 996 999 int i = 0; 1000 // Use fetch joins for columns appearing in the ORDER BY clause 1001 // if the query is distinct and the database requires it 1002 boolean selectOrderBy = query.isDistinct() && 1003 HibernateUtil.getDbEngine().selectOrderByColumnsIfDistinct(); 997 1004 for (String property : leftJoins) 998 1005 { 1006 boolean fetch = selectOrderBy && sortedProperties.contains(property); 999 1007 if (property.startsWith("@")) property = property.substring(1); 1000 1008 i++; 1001 query.join(Hql.leftJoin( property, "alj"+i));1009 query.join(Hql.leftJoin(null, property, "alj"+i, null, fetch)); 1002 1010 } 1003 1011 }
Note: See TracChangeset
for help on using the changeset viewer.