Hi everyone, I hope this message finds you well.
I would like to discuss the use of the @Builder annotation for entity classes in Fineract. In a recent pull request #3984 <https://github.com/apache/fineract/pull/3984/files>, I introduced the @Builder pattern for entity creation. However, upon further discussion with @Adam Saghy <adamsa...@apache.org>, some concerns have emerged that warrant community feedback: *Concerns with Using @Builder for Entities:* - Incompatibility with The ORM (interfere with lazy loading, entity management ...etc.) - No validation or transformation enforcement when instantiating the entity. - Builder pattern might be confusing and let others to set or override things that should not be. *Some Proposed Solutions:* - Adding `@NoArgsConstructor` & `@AllArgsConstructor` for resolving the JPA issues. - Implementing methods like fullEntryFrom() <https://github.com/apache/fineract/blob/develop/fineract-core/src/main/java/org/apache/fineract/commands/domain/CommandSource.java#L136> to encapsulate the creation logic, thereby enforcing validation and transformations while utilizing the builder pattern to avoid large constructors with many parameters. - Limiting the builder’s access to private or package-private scope and using @Builder.Default to provide specific methods for controlled instantiation. Your input on this matter would be greatly appreciated. Best regards, Zeyad Nasef