Why are interface projections much slower than constructor projections and entity projections in Spring Data JPA with Hibernate?

前端 未结 1 1702
迷失自我
迷失自我 2020-12-24 07:53

I\'ve been wondering which kind of projections should I use, so I did a little test, which covered 5 types of projections (based on docs: https://docs.spring.io/spring-data/

相关标签:
1条回答
  • 2020-12-24 08:14

    I experienced similar behavior with an older version of Spring Data and this was my take on it: https://blog.arnoldgalovics.com/how-much-projections-can-help/

    I had a talk with Oliver Gierke (Spring Data lead) and he made some improvements (that's why you get so "good" results :-) ) but basically there will be always a cost on having abstractions vs coding it manually.

    This is a trade-off as everything else is. On one hand you got flexibility, easier development, less maintenance (hopefully), on the other hand you get full control, a bit uglier query model.

    0 讨论(0)
提交回复
热议问题