<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 閱讀(531) 評論(0)  編輯  收藏 所屬分類: 工作總結

    主站蜘蛛池模板: 亚洲人成色7777在线观看| 18禁止看的免费污网站| 国产精品二区三区免费播放心| 亚洲一级毛片免费看| 91精品成人免费国产片| 亚洲人成在线精品| 1024免费福利永久观看网站| 亚洲综合久久成人69| 免费观看激色视频网站(性色)| 亚洲天堂福利视频| 国产精品无码免费播放| 亚洲色大成网站www永久男同| 免费的一级片网站| 美女裸体无遮挡免费视频网站| 亚洲成A人片77777国产| 国产99久久久久久免费看| 亚洲日韩中文无码久久| 91香焦国产线观看看免费| 7777久久亚洲中文字幕| 日本v片免费一区二区三区 | 国产一级淫片a免费播放口之| 国产亚洲男人的天堂在线观看| 国产成人亚洲综合无码| 久久国产精品成人免费| 亚洲fuli在线观看| 午夜网站免费版在线观看| sss日本免费完整版在线观看| 亚洲avav天堂av在线不卡| 18勿入网站免费永久| 老妇激情毛片免费| 亚洲成AV人片一区二区密柚| 中文字幕在线免费| 亚洲AV日韩综合一区| 亚洲真人无码永久在线| 成人午夜免费福利视频| 在线观看亚洲专区| 亚洲国产精品免费视频| 大香人蕉免费视频75| 两性色午夜免费视频| 亚洲综合丁香婷婷六月香| 国产精品亚洲美女久久久|