Announcement

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

    Any utility methods to construct where clause from criteria

    Isomorphic,

    I would like to know if there is a utility method in the api's to construct a whereClause from the criteria I provide. We use some sub-queries etc in our ds.xml file. So we end up having two whereClauses, especially when UNION is used. Anything that would just take criteria or advancedCriteria object and create the appropriate where clause irrespective of the datasource or operationBinding. I know its a bit of ridiculous question to ask considering that criteria has no way of knowing the fieldname type etc. but just trying out my luck. :)

    I cannot use the SQLDataSource.getClause as this method actually constructs the clause based on the ds.xml file.

    My idea is in case of UNION to push one query whereClause with $defaultWhereClause and another with $defaultWhereClause2 constructed manually and put using addToTemplateContext. So utility method will help me in the $defaultWhereClause2 construction.

    Thanks.

    #2
    I'm just trying to see if I can avoid writing the ugly SQL construction in java, which I seriously hate. :)

    Comment


      #3
      getSQLClause is the right API, we don't put criteria together without schema. But you can dynamically generate a DataSource using DataSource.fromXML().

      Comment

      Working...
      X