<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 :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

    hbn 筆記

    Posted on 2007-08-09 14:30 G_G 閱讀(390) 評(píng)論(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. 容器儲(chǔ)存 (從表沒主鍵) 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. 列為對(duì)象
    <set name="emails" table="email">
    <key column="id"/>
    <composite-element class="onlyfun.caterpillar.MailAddress">
    <property name="address" column="address"/> //調(diào)用 getAddress()
    </composite-element>
    </set>



    評(píng)論

    # re: hbn 筆記  回復(fù)  更多評(píng)論   

    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 筆記  回復(fù)  更多評(píng)論   

    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 筆記  回復(fù)  更多評(píng)論   

    2007-10-12 16:21 by G_G
    Configuration ->
    //方法 doConfigure 有 dom4j用法
    protected Configuration doConfigure(org.dom4j.Document doc)
    主站蜘蛛池模板: 亚洲第一永久AV网站久久精品男人的天堂AV | 女人毛片a级大学毛片免费| 国产又黄又爽又大的免费视频 | 免费网站看v片在线香蕉| 久久九九AV免费精品| 一区二区免费在线观看| 自拍日韩亚洲一区在线| 亚洲综合成人网在线观看| 亚洲伊人久久精品影院| 免费人成在线观看视频播放| 四虎成人免费观看在线网址| 99无码人妻一区二区三区免费| 久久aⅴ免费观看| 中文字幕乱码免费看电影| 国产成人无码精品久久久久免费 | 免费无码又黄又爽又刺激| 最近新韩国日本免费观看| 久久国产乱子精品免费女| 一级视频免费观看| 一级做a爰片性色毛片免费网站| 精品国产_亚洲人成在线| 亚洲精品自偷自拍无码| 亚洲综合激情五月丁香六月| 亚洲伊人久久大香线蕉影院| 亚洲毛片基地日韩毛片基地| 久久精品a亚洲国产v高清不卡| 亚洲天天做日日做天天看| 亚洲免费在线视频| 久久亚洲sm情趣捆绑调教| 内射少妇36P亚洲区| 亚洲精品国产福利片| 亚洲精品中文字幕无码AV| 亚洲日本视频在线观看| 亚洲熟妇无码久久精品| va天堂va亚洲va影视中文字幕| 波多野结衣亚洲一级| 亚洲欧美日韩综合俺去了| 性色av极品无码专区亚洲| 西西人体大胆免费视频| 成年免费大片黄在线观看com| 国产精品福利片免费看|