Grails
  1. Grails
  2. GRAILS-8719

Grails doesn't save simple String:String maps correctly.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0 final
    • Fix Version/s: 2.0.4
    • Component/s: None
    • Labels:

      Description

      Have the following domain class:

      class Word {
          Map translations
          String toString(){
              id
          }
      }
      

      And code in BootStrap:

      def word1 = new Word(translations: [en:"game"]);
      word1.save(failOnError: true, flush: true)
      
      def word2 = new Word(translations: [en:"life"]);
      word2.save(failOnError: true, flush: true)
      
      def word3 = new Word(translations: [en:"gate"]);
      word3.save(failOnError: true, flush: true)
      
      def word4 =  new Word().with {
          translations = [ en:'time' ] ;
          save( failOnError:true, flush:true )
      }
      
      println Word.get(word3.id).translations
      println Word.get(word4.id).translations
      

      And have the following output:

      [:]
      [en:time]
      

      Obviously it's a bug.

        Activity

        Hide
        Jeff Scott Brown added a comment -

        I don't think this is related to .save() or to persistence. I think it is a data binding issue.

        def word1 = new Word(translations: [en:"game"])
        
        // at this point I think word1.translations is an empty Map
        

        I will look into it.

        Show
        Jeff Scott Brown added a comment - I don't think this is related to .save() or to persistence. I think it is a data binding issue. def word1 = new Word(translations: [en:"game"]) // at this point I think word1.translations is an empty Map I will look into it.
        Hide
        Jeff Scott Brown added a comment -

        I think this was fixed in Grails 2.0.4

        Show
        Jeff Scott Brown added a comment - I think this was fixed in Grails 2.0.4

          People

          • Assignee:
            Jeff Scott Brown
            Reporter:
            Ilya A.
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development