can I perform a query inside of JPA entity to get back a single column

前端 未结 2 1802
自闭症患者
自闭症患者 2021-01-25 17:42

I have a dumb question. It would be great if this could be done, but I am not holding my breath.

I need a single column from a table linked to my JPA entity to be a c

相关标签:
2条回答
  • 2021-01-25 18:25
    @ElementCollection(fetch=FetchType.EAGER)
            @CollectionTable(name="QUICK_LAUNCH_DISTLIST",joinColumns=@JoinColumn(name="QUICK_LAUNCH_ID"))
            @Column(name="LIST_ID")
    private List<Long> distListIDs;
    

    The ElementCollection attribute is what I was looking for. It seems to work pretty well in addition to that.

    Thanks for the help and inspiration guys.

    0 讨论(0)
  • 2021-01-25 18:29

    Suppose a Category has many products:

    select product.name from Category c inner join c.products product where ...
    

    If that's not what you want, please show an example in your question.

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