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



sql查询hibernate版本问题!!!!!!!!!!


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


sql查询hibernate版本问题!!!!!!!!!!
发表于:2007-02-13 11:19:46 楼主
在hibernate2.1.1执行排序查询,hibernate生成的原生sql没问题的

select   top   20   news0_.news_id   as   news_id   ,news0_.title   as   title,news0_.upload_time   as   upload_time
from   alumni_news   news0_   where   1=1   order   by   news0_.upload_time   asc

在hibernate3.1以上执行排序查询,hibernate生成的原生sql就有没问题

select   top   20   news0_.news_id   as   news1_,   news0_.title   as   title0_,     news0_.upload_time   as   upload6_0_,  
from   alumni_news   news0_   where   1=1   order   by   news0_.upload_time     asc

在3.1之后的由于排序字段是由参数传入,hibernate不能转换它自己的别名,所以结果不正确!!!!!.
求解!!!!!!!!!!


快速检索

最新资讯
热门点击