Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    DSResponse uses "1"="1" in WHERE when adding Criteriato DSRequest

    I have an XML datasource auto generated from the Smartclient datasource generator.
    I then wrote a small piece of code to try and run a simple query but it is either because I am using an evaluation copy or it simply is broken as reflected in many of the posts I have found that are along similar lines.

    This small piece of code:
    DSRequest i18nDs = new DSRequest("i18nDs", "fetch");
    try {
    i18nDs.addToCriteria(new SimpleCriterion("LANG_", DefaultOperators.Equals, lang));
    i18nDs.addToCriteria(new SimpleCriterion("CNTRY_", DefaultOperators.Equals, country));
    i18nDs.addToCriteria(new SimpleCriterion("VRNT_", DefaultOperators.Equals, variant));
    DSResponse dr = i18nDs.execute();
    } catch (Exception e1) {
    // TODO Auto-generated catch block
    e1.printStackTrace();
    return null;
    }
    The resulting query has this in the WHERE clause:
    SELECT .... FROM .... WHERE '1' = '1' AND '1' = '1' and '1' = '1'
    Even if I use the more simple : 18nDs.addToCriteria("LANG_", lang);
    ... it does the same thing.

    What am I missing?

    #2
    Hi,

    for me this happens if the Criteria fieldName does not match the ds.xml field "name"-attribute.

    Can you show your ds.xml as well?

    Best regards
    Blama

    Comment


      #3
      DOH!!! Thanks for that .... the fields are in lower case in the ds.xml ... it works now. Thanks for the pointer, much appreciated

      Comment

      Working...
      X