Adding a Projection to a List in Hibernate

前端 未结 3 447
深忆病人
深忆病人 2021-01-21 17:39

I have a @Entity called Order in this I have a field or a member variable called orderEmails as show below.

@Entity
@Table(name = \"order\")
public class Order {         


        
3条回答
  •  走了就别回头了
    2021-01-21 17:57

    Even it's a little bit late but never too late, You make your normal projection with a list inside then in the end it's possible in hibernate to return one line using this :

    .setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY)
    

    Details here: Criteria.DISTINCT_ROOT_ENTITY vs Projections.distinct

提交回复
热议问题