Uploaded image for project: 'Spring Tool Suite'
  1. Spring Tool Suite
  2. STS-1495

renaming domain class fields should adjust query references (dynamic finders, etc)

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Won't Fix
    • 2.5.2.RELEASE
    • None
    • GRAILS

    Description

      Domain class:

      class Album {
        String title
      }
      

      controller code:

      ...
      Album.findByTitle('abc')
      ...
      

      Refactor rename of Album title to something else should be able to change dynamic finder. Change title to 'foobar', dynamic finder becomes findByFoobar.

      There are probably similar problems if using this mechanism:

        Album.find(new Album(title:'abc'))
      

      The 'title:' is not renamed.

      Or this mechanism:

      def c = Album.createCriteria()
      def results = c {
           like("title", "Wibble%")
      }
      

      Or this mechanism:

      def results =
            Album.findAll("from Album as a where a.title like 'The Joshua Tree'")
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            aclement Andy Clement
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: