Grails
  1. Grails
  2. GRAILS-8623

Problem with 'where' queries executed from Controller

    Details

      Description

      When trying to execute a "where" query inside a closure styled action in a controller, the result returned consists of all the records in the database for that domain instead of the filtered records. Run the attached sample application and hit the given URL's:

      http://localhost:8080/test/address/useClosureStyleAction - Results in an assertion failure
      http://localhost:8080/test/address/useMethodStyleAction - Executes without any problem

      The action bodies, however, for both the actions are the same as given below:

      def addresses = Address.where {city == "Noida"}.list()
      assert addresses*.city == ["Noida", "Noida"]
      render addresses*.city
      

        Activity

        Show
        Graeme Rocher added a comment - Fixed by https://github.com/SpringSource/grails-data-mapping/commit/d241464fbbd49455504bc9ed125a314f41e38a06

          People

          • Assignee:
            Graeme Rocher
            Reporter:
            Roni C Thomas
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development