Skip to content

Using an id that can be bindable will throw java.lang.NumberFormatException #45

@sergiomichels

Description

@sergiomichels

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).

class MyDomainClass {
  String descr

  static constraints = {
    id bindable: true, generator: 'assigned'
  }

}

JSON POST
{"id":77,"desc":"Test"}

MyDomainClass domain = new MyDomainClass(params) //java.lang.NumberFormatException

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions