Grails: setting transient fields in the map constructor

后端 未结 3 1097
夕颜
夕颜 2020-12-20 03:27

I\'m trying to persist Maps of properties as single JSON-encoded columns, as shown in this question.

The problem I\'m having is that apparently transient pro

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-20 03:50

    You can simplify your case by adding the JSON-conversion methods to your domain class, they should have nothing to do with GORMing:

    class Test {
        String title
    
        void titleFromJSON( json ){ 
          title = json.toStringOfSomeKind()
        }
    
        def titleAsJSON(){ 
          new JSON( title )
        }
    
    }
    

提交回复
热议问题