axelor / axelor-open-platform

Open source Java framework for business application development
http://axelor.com
Other
391 stars 298 forks source link

Unable to define a non cascading object in many2one relation (fetch annotation only) #98

Open CITIZENGATE opened 3 years ago

CITIZENGATE commented 3 years ago

Hi,

It could be really usefull to not add new domain field flag to avoid the annotation "cascade = { CascadeType.PERSIST, CascadeType.MERGE }" to be added in many2one relation.

As an example:

I test it by updating the axelor-gradle/groovy/Property.groovy and by introducing a new xml tag name "cascadable" in a domain field. If cascadable if not specified, cascade annotation is added as usually, if cascadable="false" is specified, cascading is not applied to the childed object.

Maybe it could be great to add this feature in a future release because I was not able to find a way to do it with the lasrt release of the Open Platform.

More over, sometime, if you need to add custom annotation on a class field, it could be also useful to manage an "annotations" attribute inside a domain field to make able to customize the field uring the groovy generation. As an example, adding inside the domain field definition "annotations=com.fasterxml.jackson.annotation.JsonBackReference" will add the "@JsonBackReference" to the class field.

Thanks you

Regards

Eric