[英]Spring-Data projections. The correct way?
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.在尝试将 JPA 与旧数据库一起使用时,我得出的结论是,我需要获取 50-60 个巨大的列表列的子集,因为单个选择语句生成的查询可能有 4 或 5 张左右有无数个连接的纸长。
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.我想知道,各位专家如何面对这个主要与性能和效率相关的问题,但也与应用程序的设计以及您如何以合理的方式构建项目、实体、pojo 等有关。
About the class containing the result:关于包含结果的类:
How would this interact with the dependent layers?这将如何与依赖层交互?
我会使用@Query 和自定义代码查询带有代表所需模型的 DTO,节省内存,也更喜欢 Spring-Data-JDBC 而不是 JPA
我会使用 Spring 的 JDBC 模板: https : //spring.io/guides/gs/relational-data-access/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.