Hibernate中Query查询问题

from Item item
join item.bids bid
where item.description like '%gc%'
and bid.amount > 100

这样得出来的是两个对象
item 和bid

通过这样进行查询
Query q = session.createQuery("from Item item join item.bids bid");
Iterator pairs = q.list().iterator();
Joining associations 263
while ( pairs.hasNext() ) {
Object[] pair = (Object[]) pairs.next();
Item item = (Item) pair[0];
Bid bid = (Bid) pair[1];
}


如果是
select item
from Item item
join item.bids bid
where item.description like '%gc%'
and bid.amount > 100
那么只得出的是一个对象

posted on 2007-09-15 16:14 刘铮 阅读(352) 评论(0)  编辑  收藏 所属分类: Hibernate


只有注册用户登录后才能发表评论。


网站导航:
 
<2024年6月>
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456

导航

统计

留言簿(1)

文章分类(141)

文章档案(147)

搜索

最新评论