Currently, dto properties will be generated for all methods that follow the T getX() or setX(T t) pattern. This includes 'generator' methods where the property does not correspond to and field of the domain class. For example, given the class
public class Brother {
public Long id;
public String getGender() {
return "male";
}
}
the generated DTO will have two properties;
Long id
and
String gender
.
In a simple case like this the behavior is harmless. It becomes a problem however if the domain getter performs an expensive operation like a database query. There is also the potential for conflicts with mapping references as Ids.
Is this the expected behavior, and if so would it be worthwhile to have a config setting to allow the user to include/exclude these properties?
Currently, dto properties will be generated for all methods that follow the T getX() or setX(T t) pattern. This includes 'generator' methods where the property does not correspond to and field of the domain class. For example, given the class
the generated DTO will have two properties;
and
.
In a simple case like this the behavior is harmless. It becomes a problem however if the domain getter performs an expensive operation like a database query. There is also the potential for conflicts with mapping references as Ids.
Is this the expected behavior, and if so would it be worthwhile to have a config setting to allow the user to include/exclude these properties?