You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using parseRequest:true in UrlMappings the GSON.parse() method is parsing the id as a Double, causing problems when you create the instance from the params map and your domain class can have the id bindable (I need this for legacy databases).
I also tried creating the instance from request.GSON, but it returns null (still don't figured out why).
This might be due to the following:
If a JSON object contains an id property then it will use GORM to retrieve an existing instance, otherwise it creates a new one.
As a result, the deserialzer (GrailsDomainSerializer.groovy from the plugin) doesn't work well for domains that have 'assigned' ids. As a workaround, you can remove the id from the gson/params before, and manually assign the id later.
def id = params.remove('id')
MyDomainClass domain =newMyDomainClass(params)
domain.id = id
When using parseRequest:true in UrlMappings the GSON.parse() method is parsing the id as a Double, causing problems when you create the instance from the params map and your domain class can have the id bindable (I need this for legacy databases).
It would be nice to convert the id to the Long, or his declared type, instead of using Google's default.
I also tried creating the instance from request.GSON, but it returns null (still don't figured out why).
The text was updated successfully, but these errors were encountered: