Author: smarlow(a)redhat.com
Date: 2010-01-06 11:59:34 -0500 (Wed, 06 Jan 2010)
New Revision: 18419
Modified:
core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java
Log:
HHH-4688 Make sure @OrderBy works for @ElementCollection. Handle default case
Modified:
core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java
===================================================================
---
core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java 2010-01-06
14:37:38 UTC (rev 18418)
+++
core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java 2010-01-06
16:59:34 UTC (rev 18419)
@@ -1243,7 +1243,8 @@
element.setFetchMode( FetchMode.JOIN );
element.setLazy( false );
element.setIgnoreNotFound( ignoreNotFound );
- if ( StringHelper.isNotEmpty( hqlOrderBy ) ) {
+ // as per 11.1.38 of JPA-2 spec, default to primary key if no column is specified by
@OrderBy.
+ if ( hqlOrderBy != null ) {
collValue.setManyToManyOrdering(
buildOrderByClauseFromHql( hqlOrderBy, collectionEntity, collValue.getRole() )
);
Show replies by date