开发者

Hibernate: How to query to an object which it's collection proprty contains a specific value?

I've got a Player Object in which there is a Collection<Stock>. I'm willing to write a hibernate query which returns the list of playe开发者_运维百科rs who have a specific stock (for example stock.symbol="**").

any ideas?


No problem use HQL with join syntax.

see it here

http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/queryhql.html#queryhql-joins-forms

For example:

Player p join p.myStocks stock where stock.symbol = :symbol
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜