Grails params assignement transforms a map of objects to a map of strings

Rainman4500

New member
According to Grails doc I can have a Map of objects in a Domain http://grails.org/doc/latest/guide/GORM.html#sets,ListsAndMaps

In Bootstrap and unit tests it works fine. I pre-fill my map in the domain constructor.

enum.each{
domainObject tmp = new DomainObject()
map.putAt(it.value, tmp)
}
Where It fails is the the PARAMS assigment in a controller or command.

def tmp = new DomainObject()
// Holds a complete map of objects with version id etc..

tmp.properties = params
// the map is NOW automatically transformed to a map of strings
My params have the following format in case that is the issue

comments[keya]id ""
comments[keya]comment "this is the comment"
comments[keyb]id ""
comments[keyb]comment "this is another comment"
So far The only solution I see is make everything a LIST and FIND the appropriate key when displaying and saving. I seem to missing the point on how to make a map of object work.
 
Top