When to use Hibernate projections?

后端 未结 4 552
感情败类
感情败类 2021-01-30 09:02

I am a little confused about Hibernate\'s projections and criteria. When to use projections and when to use criteria?

4条回答
  •  旧时难觅i
    2021-01-30 09:38

    Hibernate projections are useful for

    1)Fetching only certain columns of the table

    2)Performing aggregations like count,sum,max,min,avg.

    Fetching only the columns which are needed improves the performance of the query.

    Examples of projection

    Projections using DTO

    Projection List example

提交回复
热议问题