<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)  編輯  收藏 所屬分類: 工作總結

    主站蜘蛛池模板: 国产精品亚洲玖玖玖在线观看| 久草视频免费在线观看| 波多野结衣久久高清免费| 久久精品亚洲AV久久久无码| 亚洲w码欧洲s码免费| 亚洲色图古典武侠| 青青在线久青草免费观看| 亚洲AV成人影视在线观看| 成人免费视频一区二区三区| 国产亚洲精品成人AA片| 免费看国产一级片| 一个人看的www在线免费视频 | 亚洲精品无码国产片| 麻豆国产VA免费精品高清在线 | 国产日韩AV免费无码一区二区 | 久久亚洲精品无码| 久久不见久久见免费视频7 | 国产乱辈通伦影片在线播放亚洲| 男女啪啪免费体验区| 亚洲精品国产成人片| 91大神在线免费观看| 亚洲乱码无人区卡1卡2卡3| 免费人成视网站在线观看不卡| www永久免费视频| 亚洲日本中文字幕区| 无遮免费网站在线入口| 粉色视频免费入口| 亚洲精品无码久久久久sm| 一区二区三区四区免费视频| 在线观看亚洲AV日韩AV| 亚洲精品尤物yw在线影院| 57pao一国产成永久免费| 国产午夜亚洲精品不卡电影| 亚洲日韩一页精品发布| 国产高清不卡免费在线| 色噜噜狠狠色综合免费视频| 一区二区三区亚洲| 国产一区二区免费在线| 国产猛男猛女超爽免费视频| 亚洲砖码砖专无区2023| 国产gv天堂亚洲国产gv刚刚碰|