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

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

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

    posts - 165, comments - 198, trackbacks - 0, articles - 1
      BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

    hbn 筆記

    Posted on 2007-08-09 14:30 G_G 閱讀(390) 評論(3)  編輯  收藏 所屬分類: hibernate


    1.Criteria 的 or?

    ???? public ?List?getFind(String[]?dpids?) {
    ????????Criteria?cr?
    = ??getCriteriaBegin(Deptid. class );
    ????????
    ????????cr.add(?Restrictions.or(?
    ????????????????????Restrictions.eq(
    " dpid " ,?dpids[ 0 ]?)?,?
    ????????????????????Restrictions.eq(?
    " dpid " ?,dpids[ 1 ]?)?)
    ????????????????);
    ????????
    ????????
    return ?getCriteriaEnd(cr);
    ????}

    2. 容器儲存 (從表沒主鍵) 1)Set? 的 .xml
    ???? ??? ??? 引用? http://caterpillar.onlyfun.net/GossipCN/HibernateGossip/HibernateGossip.html
    	<set name="emails" table="email">//email表 就 2列 id address
    <key column="id"/> //email表的主鍵 也是主表的主鍵
    ? <element type="java.lang.String" column="address"/>
    </set>
    .java private Set emails; //存和外鍵同
    2)List? 的 .xml
    <list name="items" table="item">
    <key column="id"/> //為item表的 idINT(11) NOT NULL,
    <index column="position"/> //為表的 position INT(11) NOT NULL,
    <element type="java.lang.String" column="name"/>//為表的name VARCHAR(100) NOT NULL default ''
    </list>
    。。。。。
    3. 列為對象
    <set name="emails" table="email">
    <key column="id"/>
    <composite-element class="onlyfun.caterpillar.MailAddress">
    <property name="address" column="address"/> //調用 getAddress()
    </composite-element>
    </set>



    評論

    # re: hbn 筆記  回復  更多評論   

    2007-10-10 10:50 by G_G
    源碼分析
    在 Factory中
    private static final ThreadLocal threadLocal = new ThreadLocal();
    的使用 可以參考
    http://www.java3z.com/cwbwebhome/article/article2a/275.jsp?id=324

    線程安全
    Session session = (Session) threadLocal.get();
    if (session == null) {
    if (sessionFactory == null) {
    try {
    cfg.configure(CONFIG_FILE_LOCATION);
    sessionFactory = cfg.buildSessionFactory();
    }
    catch (Exception e) {
    System.err.println("%%%% Error Creating SessionFactory %%%%");
    e.printStackTrace();
    }
    }
    session = sessionFactory.openSession();
    threadLocal.set(session);
    }

    return session;

    # re: hbn 筆記  回復  更多評論   

    2007-10-10 10:57 by G_G

    hbn 加載文件

     ConfigHelper.getResourceAsStream
    public static InputStream getResourceAsStream(String resource) {
    String stripped
    = resource.startsWith("/") ?
    resource.substring(
    1) : resource;

    InputStream stream
    =null;
    ClassLoader classLoader
    = Thread.currentThread().getContextClassLoader();
    if (classLoader!=null) {
    stream
    = classLoader.getResourceAsStream( stripped );
    }
    if ( stream ==null ) {
    Environment.
    class.getResourceAsStream( resource );
    }
    if ( stream ==null ) {
    stream
    = Environment.class.getClassLoader().getResourceAsStream( stripped );
    }
    if ( stream ==null ) {
    thrownew HibernateException( resource +" not found" );
    }
    return stream;
    }

    # re: hbn 筆記  回復  更多評論   

    2007-10-12 16:21 by G_G
    Configuration ->
    //方法 doConfigure 有 dom4j用法
    protected Configuration doConfigure(org.dom4j.Document doc)
    主站蜘蛛池模板: 亚洲免费在线观看| 国产精品亚洲а∨无码播放不卡 | 亚洲成a人片在线不卡一二三区| 午夜视频免费在线观看| 亚洲第一福利视频| 久久美女网站免费| 亚洲伊人tv综合网色| 香蕉成人免费看片视频app下载| 亚洲成人动漫在线| www.免费在线观看| 亚洲一卡2卡3卡4卡5卡6卡| 天天摸天天操免费播放小视频| 亚洲av无码无线在线观看| 国产在线19禁免费观看国产| 免费人成动漫在线播放r18 | 色偷偷亚洲女人天堂观看欧| 四虎影视大全免费入口| 国产亚洲美女精品久久| 在线日韩日本国产亚洲| 久久精品国产大片免费观看| 亚洲日本国产乱码va在线观看| 大地资源二在线观看免费高清| 亚洲日韩国产二区无码| 亚洲国产成人爱av在线播放| 视频免费在线观看| 亚洲国产精品线观看不卡| 国产精品国产午夜免费福利看| 国产久爱免费精品视频| 久久夜色精品国产噜噜亚洲AV| 天天干在线免费视频| 久久精品成人免费观看97| 亚洲视频在线观看免费| 午夜电影免费观看| 99免费在线视频| 亚洲av永久无码精品天堂久久| 亚洲Av无码国产情品久久 | 国产免费爽爽视频在线观看| 亚洲日韩中文字幕天堂不卡| 国产一区二区三区免费视频| 免费国产污网站在线观看15| MM1313亚洲精品无码久久|