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:
You have an object "Oil history" and an object "Car"
The Oil History referers to the Car.
When you persist an Oil History if the Car object has been changed, JPA will throw a persistent error due to the version changed of the Car.
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.
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