Issue
In my attempt of using JPA with a legacy database, I've came to the conclusion I need to obtain a subset of my huge 50-60 column tables columns, since the queries generated by one single select sentence can be around 4 or 5 sheets of paper long with a endless number of joins.
I am wondering, how you experts, face this problem related mainly to performance and efficency, but also with the application's design and how you do structure your project, entities, pojos etc in a reasonable way.
About the class containing the result:
- Is it OK to use the full entity class to return 2 or 3 columns from a table?
- Would you use a POJO in a DTO-fashioned way?
- Or a shortened version of the entity referncing the same table?
How would this interact with the dependent layers?
Solution
I'd use Spring's JDBC template: https://spring.io/guides/gs/relational-data-access/
Answered By - Griff
Answer Checked By - Senaida (JavaFixing Volunteer)