<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    天空是藍色的

    做好軟件為中國 #gcc -c helloworld.c -o helloworld.o //編譯目標文件 #gcc helloworld.o -o helloworld //編譯成可執行exe #helloworld //運行exe
    數據加載中……
    Hibernate的分頁
     Session session = HibernateUtil.currentSession();

    Transaction tx 
    = session.beginTransaction();
    Query query 
    = session.createQuery("from Cat");

    query.setFirstResult(
    0);//開始
    query.setMaxResult(10);//最大
    for (Iterator it = query.iterate(); it.hasNext();) {
          
    //Object obj = it.next();
    }

    tx.commit();
    HibernateUtil.closeSession();

    HibernateUtil.java

    public class HibernateUtil {
        
    private static final SessionFactory sessionFactory;

        
    static {
            
    try {
                
    // Create the SessionFactory
                Configuration cfg = new Configuration().configure();
                sessionFactory 
    = cfg.buildSessionFactory();
            }
     catch (Throwable ex) {
                
    throw new ExceptionInInitializerError(ex);
            }

        }


        
    public static final ThreadLocal session = new ThreadLocal();

        
    public static Session currentSession() {
            Session s 
    = (Session) session.get();
            
    if (s == null{
                
    try {
                    s 
    = sessionFactory.openSession();
                }
     catch (HibernateException e) {
                    
    // TODO Auto-generated catch block
                    e.printStackTrace();
                }

                session.set(s);
            }

            
    return s;
        }


        
    public static void closeSession() {
            Session s 
    = (Session) session.get();
            
    if (s != null)
                
    try {
                    s.close();
                }
     catch (HibernateException e) {
                    
    // TODO Auto-generated catch block
                    e.printStackTrace();
                }

            session.set(
    null);
        }


    }

    posted on 2005-12-21 14:16 bluesky 閱讀(537) 評論(0)  編輯  收藏 所屬分類: 工作總結

    主站蜘蛛池模板: 国产成人综合久久精品免费| 成人国产mv免费视频| 国产成人精品日本亚洲18图| 四虎成人精品一区二区免费网站| 猫咪免费观看人成网站在线| 亚洲成AV人片在线观看无| 日日麻批免费40分钟日本的| 2020亚洲男人天堂精品| 亚洲日韩在线中文字幕第一页| 特级无码毛片免费视频尤物| 亚洲欧美aⅴ在线资源| 亚洲AV无码国产精品麻豆天美| 可以免费看的卡一卡二| 精品免费久久久久国产一区| 亚洲一区二区三区国产精品无码| 亚洲精品456播放| 国产精品视频免费| 中国好声音第二季免费播放| 亚洲欧美日韩久久精品| 亚洲国产香蕉碰碰人人| 全部免费毛片在线| 国产h肉在线视频免费观看| 一级黄色免费毛片| 色婷五月综激情亚洲综合| 亚洲AV无码专区在线播放中文 | 一级毛片在播放免费| 亚洲jjzzjjzz在线观看| 国产AV无码专区亚洲AV男同| 日本一道在线日本一道高清不卡免费| 无码人妻久久一区二区三区免费| 黄色三级三级三级免费看| 亚洲一区中文字幕在线观看| 亚洲成AV人在线播放无码| 亚洲av无码乱码在线观看野外 | 亚洲无圣光一区二区| 亚洲精品麻豆av| 国产精品久久免费视频| 69天堂人成无码麻豆免费视频| 国产又黄又爽又大的免费视频| 美女黄频免费网站| 亚洲av无码一区二区三区天堂|