我现在有一个NEWS(新闻)表,我想将其中的前10条记录取出来,实现的代码如下:
public List searchNews(){
     return getSession().createQuery("from News as n order by n.date desc limit 0,10").list();
}
然后在action中将其传到页面
List newses =newManager.searchNews()();
request.setAttribute("news", newses);
可是在页面却是显示出了所有的NEWS中的记录,在百度找下有人说是可能hibernate的配置问题,我的hibernate的配置是:
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="hibernate.connection.url">jdbc:mysql://127.0.0.1/oa</property>
    <property name="hibernate.connection.username">root</property>
    <property name="hibernate.connection.password">root</property>
    <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
    <property name="hibernate.show_sql">true</property>
    <property name="hibernate.hbm2ddl.auto">update</property>
    
    <property                             
     name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
请高手指点下。