From: <hib...@li...> - 2006-05-01 21:40:44
|
Author: epbernard Date: 2006-05-01 17:40:41 -0400 (Mon, 01 May 2006) New Revision: 9846 Modified: trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/CollectionBinder.java Log: ANN-336 partial implementation, does not work for indexes and ignore the "element" thing Modified: trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/CollectionBinder.java =================================================================== --- trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/CollectionBinder.java 2006-05-01 20:12:39 UTC (rev 9845) +++ trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/CollectionBinder.java 2006-05-01 21:40:41 UTC (rev 9846) @@ -533,7 +533,7 @@ isEmbedded, collType, ignoreNotFound, unique, cascadeDeleteEnabled, - associationTableBinder, property, mappings + associationTableBinder, property, hqlOrderBy, mappings ); return false; } @@ -768,7 +768,7 @@ String collType, boolean ignoreNotFound, boolean unique, boolean cascadeDeleteEnabled, - TableBinder associationTableBinder, XProperty property, ExtendedMappings mappings + TableBinder associationTableBinder, XProperty property, String hqlOrderBy, ExtendedMappings mappings ) throws MappingException { PersistentClass collectionEntity = (PersistentClass) persistentClasses.get( collType ); @@ -803,6 +803,10 @@ } } } + if ( ! isCollectionOfEntities && StringHelper.isNotEmpty( hqlOrderBy ) ) { + //@ManyToMany can't handle order by on the target table + collValue.setOrderBy( hqlOrderBy ); + } boolean mappedBy = ! AnnotationBinder.isDefault( joinColumns[0].getMappedBy() ); if ( mappedBy ) { if ( ! isCollectionOfEntities ) { |