Grails
  1. Grails
  2. GRAILS-172

Add dynamic methods for simplifying creation of bidirectional relationships

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.1
    • Fix Version/s: 0.3
    • Component/s: Persistence
    • Labels:
      None

      Description

      Currently to make sure the integrity of a bidirectional relationship is maintained you have to write repetive code like this:

      class Author {
              Set books
      
              def addBook(book) {
                    if(!books) books = new HashSet()
                    book.author = this
                    books.add(book)
                    return this
              }
      }
      

      The 'addBook' method is essentially the same each time and can be encapsulated in a dynamic method based on the properties of the domain class hence eliminating the need to write these each time

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Graeme Rocher
            Reporter:
            Graeme Rocher
          • Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development