Version property missing when converting Domain to JSON

95 views Asked by At

In GORM-standalone I have a simple domain class like:

@JsonIgnore( [ 'owner' ] )
class Person implements MongoEntity<Person>{
  String id
  String name
  String owner

  Long version // attempt to hack
}

When an instance of Person is converted to JSON, the version is not output to resulting JSON string.

Any way to get it done automatically?

P.S. Even adding version prop expicitly does NOT add it to resulting JSON...

1

There are 1 answers

1
Vahe92 On

You can set the configuration property in grails-app/conf/Config.groovy

grails.converters.domain.include.version = true

or in grails-app/conf/application.yml

grails:
  converters:
    domain:
      include:
        version: true