private Query getFKQuery ( Object obj , ClassDescriptor cld , CollectionDescriptor cds ) { Query fkQuery ; QueryByCriteria fkQueryCrit ; if ( cds . isMtoNRelation ( ) ) { fkQueryCrit = getFKQueryMtoN ( obj , cld , cds ) ; } else { fkQueryCrit = getFKQuery1toN ( obj , cld , cds ) ; } // check if collection must be ordered if ( ! cds . getOrderBy ( ) . isEmpty ( ) ) { Iterator iter = cds . getOrderBy ( ) . iterator ( ) ; while ( iter . hasNext ( ) ) { fkQueryCrit . addOrderBy ( ( FieldHelper ) iter . next ( ) ) ; } } // BRJ: customize the query if ( cds . getQueryCustomizer ( ) != null ) { fkQuery = cds . getQueryCustomizer ( ) . customizeQuery ( obj , pb , cds , fkQueryCrit ) ; } else { fkQuery = fkQueryCrit ; } return fkQuery ; }
Answer the foreign key query to retrieve the collection defined by CollectionDescriptor