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

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: 2.5.2.RELEASE
    • Fix Version/s: None
    • Component/s: 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

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

              Dates

              Created:
              Updated:
              Resolved: