您的位置:程序门 -> java -> 框架、开源



这个hql 要怎样写急急!!!


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


这个hql 要怎样写急急!!!
发表于:2008-01-18 10:48:36 楼主
from   maintaincost   m   right   join   fetch   m.capitalitem   c  
where   m.monthreportid   =   :id  
and   c.treecode   like   '00006%'   and   c.treecode   >   '00006'   order   by   c.treecode
建立了从maintaincost   到capitalitem   的many-to-one   现在这样只能查出一条记录来,本来是想显示capitalitem   中的所有记录.怎样把这个hql改成和这个sql功能一样的呢
select   *   from

        select   *   from   maintaincost   where   monthreportid   =   'aaa'
)   a
right   join
capitalitem     b  
on   a.itemid   =   b.id
where   a.treecode   like   '00006%'   and   a.treecode   >   '00006'   order   by   c.treecode
发表于:2008-01-18 10:58:551楼 得分:0
直接用原生的sql不就行了,就不能改了
querysql   query=session.createsqlquery(sql);
发表于:2008-01-18 11:39:192楼 得分:0
用本地sql查出来,关联关系就没有啦.


快速检索

最新资讯
热门点击