开发者

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

开发者 https://www.devze.com 2023-03-03 13:20 出处:网络
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 s

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

精彩评论

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