kaleidos / grails-postgresql-extensions

Grails plugin to use postgresql native elements such as arrays, hstores,...
Apache License 2.0
79 stars 63 forks source link

Use grails.converters.JSON instead of gson in JsonMapType ? #81

Open ph4t opened 8 years ago

ph4t commented 8 years ago

Hi,

In our application we are using builtin JSON class to marshall/umarshall domain classes etc. We have a lot of custom object marshallers and we are using a few plugins that integrate with Grails JSON class (https://github.com/pedjak/grails-marshallers & https://github.com/gpc/joda-time)

I would assume that most people are using the builtin JSON class as well. So, it makes more sense if JsonMapType is using class JSON instead of gson. What is the reasoning behind using gson? Are there any issues with builtin JSON?

ilopmar commented 8 years ago

Hi @ph4t.

I don't remember why we chose Gson instead of grails.converters.JSON. Maybe we had some problems with the Grails converters, but I can't remember at this moment.

Are you using Grails 2 or Grails 3? I could do some tests with the Grails converter to see what happen. Or maybe you can try to change it and submit a PR.

ph4t commented 8 years ago

I'm using Grails 2.0. We won't migrate to grails 3 anytime soon.

I'll try it and submit PR

ilopmar commented 8 years ago

If you're still using Hibernate 3 you should branch from this: https://github.com/kaleidos/grails-postgresql-extensions/tree/3.x

Please take notice that we currently are not planning to add new functionality to Hibernate 3 support (old versions of Grails). If you need new features you should think about moving to Hibernate 4 (still with Grails 2.x) and use the branch https://github.com/kaleidos/grails-postgresql-extensions/tree/grails-2.x

ph4t commented 8 years ago

We are on hibernate 4. Thanks for letting me know which branch to use...

kyledobitz commented 6 years ago

Related to this, when I include the plugin with a brand new grails 3.3 project that utilizes JsonMapType it fails to start with error: java.lang.NoClassDefFoundError: Lcom/google/gson/Gson;

Seems to be referenced/imported here: https://github.com/kaleidos/grails-postgresql-extensions/blob/0dd0f17b59eafcd3f512068f76a74fe4acc27748/src/main/groovy/net/kaleidos/hibernate/usertype/JsonMapType.groovy#L3

But not included in build.gradle as a dependency