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

荒凉一梦 提交于 2019-12-02 10:21:51

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.

@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.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!