Grails
  1. Grails
  2. GRAILS-8755

Single Line creation syntax of Domain Class with One to Many Mapping has stopped working in 2.0

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0 final
    • Fix Version/s: 2.0.1
    • Component/s: Persistence
    • Labels:
    • Environment:
      OS X 10.6.8 / Java 1.6.0_29

      Description

      Have two domain classes

      class Tag {
        String name
      }
      
      class Tournament {
        String title
        List tags
        static hasMany= [tags:Tag]
      }
      

      We could create a Tournament Instance in one line in 1.3.7

      def trnmt=new Tournament (title:'Facebook Oscars', tags: [new Tag(name:"top commenter"),new Tag(name:"top liker") ]).save()
      

      in 2.0, it gives hibernate.AssertionFailure: null id in Tag entry. I had to use trnmt.addToTags(..).

        Activity

        Hide
        Graeme Rocher added a comment -
        Show
        Graeme Rocher added a comment - Seems to be already fixed. Wrote a test to verify: https://github.com/grails/grails-core/commit/42b70d3c05ffa1f4c0dfae5f1d619b2e224a119e

          People

          • Assignee:
            Graeme Rocher
            Reporter:
            Ravi Pratap
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development