private QueryByCriteria getFKQuery1toN(Object obj, ClassDescriptor cld, CollectionDescriptor cod)
    {
        ValueContainer[] container = pb.serviceBrokerHelper().getKeyValues(cld, obj);
        ClassDescriptor refCld = pb.getClassDescriptor(cod.getItemClass());
        FieldDescriptor[] fields = cod.getForeignKeyFieldDescriptors(refCld);
        Criteria criteria = new Criteria();

        for (int i = 0; i < fields.length; i++)
        {
            FieldDescriptor fld = fields[i];
            criteria.addEqualTo(fld.getAttributeName(), container[i].getValue());
        }

        return QueryFactory.newQuery(refCld.getClassOfObject(), criteria);
    }
private QueryByCriteria getFKQuery1toN ( Object obj , ClassDescriptor cld , CollectionDescriptor cod ) { ValueContainer [ ] container = pb . serviceBrokerHelper ( ) . getKeyValues ( cld , obj ) ; ClassDescriptor refCld = pb . getClassDescriptor ( cod . getItemClass ( ) ) ; FieldDescriptor [ ] fields = cod . getForeignKeyFieldDescriptors ( refCld ) ; Criteria criteria = new Criteria ( ) ; for ( int i = 0 ; i < fields . length ; i ++ ) { FieldDescriptor fld = fields [ i ] ; criteria . addEqualTo ( fld . getAttributeName ( ) , container [ i ] . getValue ( ) ) ; } return QueryFactory . newQuery ( refCld . getClassOfObject ( ) , criteria ) ; }
Get Foreign key query for 1:n
@return org.apache.ojb.broker.query.QueryByCriteria
@param obj
@param cld
@param cod