private static Query buildQuery(ClassDescriptor cld)
    {
        FieldDescriptor[] pkFields = cld.getPkFields();
        Criteria crit = new Criteria();

        for(int i = 0; i < pkFields.length; i++)
        {
            crit.addEqualTo(pkFields[i].getAttributeName(), null);
        }
        return new QueryByCriteria(cld.getClassOfObject(), crit);
    }
private static Query buildQuery ( ClassDescriptor cld ) { FieldDescriptor [ ] pkFields = cld . getPkFields ( ) ; Criteria crit = new Criteria ( ) ; for ( int i = 0 ; i < pkFields . length ; i ++ ) { crit . addEqualTo ( pkFields [ i ] . getAttributeName ( ) , null ) ; } return new QueryByCriteria ( cld . getClassOfObject ( ) , crit ) ; }
Build a Pk-Query base on the ClassDescriptor.

@param cld
@return a select by PK query