首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

Hibernate有关问题.大家帮帮小弟我

2012-10-24 
Hibernate问题...大家帮帮我啊set nameMForums inversetrue order-byadddate DESCkeycolumn

Hibernate问题...大家帮帮我啊

        <set name="MForums" inverse="true" order-by="adddate DESC">            <key>                <column name="threadid" length="2" not-null="true" />            </key>            <one-to-many name="code">ThreadMoudle tm = new ThreadMoudle ();Session session = HibernateSessionFactory.getSession();Transaction tran = session.beginTransaction();MThreads threads = (MThreads)session.get(MThreads.class, id);tm.threads = threads;for (MForum mf : threads.getMForums()) {tm.forum.add(mf);}tran.commit();HibernateSessionFactory.closeSession();


我现在得到threads.getMForums()的值是与外键相关的全部记录...但是我只想得到前10条..我要怎么做啊...(不用Query)

热点排行