What is the best approach for handling returning non entity objects using the Active Record Pattern?
As an example lets say I have the following tables and corresponding classes to represent them.
Customer Order OrderLineItem Item
However I need a report that comprises information from all 4 tables.
It doesn't really make sense to have that method exists in either of those 4 classes. Where is the best place to place such logic? For example sake lets say I am using Java and ActiveJPA. The technology really isn't that important though, more of a design question.
In Java/Spring using Spring Data JPA and Hibernate I create a custom implementation of the Spring Data repository and drop down into JDBC for custom queries. However that is using the repository pattern, and its not an elegant solution but gets the job done.
Looking for best approach for an Active Record implementation.
Aucun commentaire:
Enregistrer un commentaire