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

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

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

    waterye

    hibernate的column級lazy

    1. Using lazy property fetching
    To enable lazy property loading, set the lazy attribute on your particular property mappings:
    <class?name="Document">
    ???????
    <id?name="id">
    ????????
    <generator?class="native"/>
    ????
    </id>
    ????
    <property?name="name"?not-null="true"?length="50"/>
    ????
    <property?name="summary"?not-null="true"?length="200"?lazy="true"/>
    ????
    <property?name="text"?not-null="true"?length="2000"?lazy="true"/>
    </class>

    Lazy property loading requires buildtime bytecode instrumentation! If your persistent classes are not enhanced, Hibernate will silently ignore lazy property settings and fall back to immediate fetching.

    For bytecode instrumentation, use the following Ant task:
    <target?name="instrument"?depends="compile">
    ????
    <taskdef?name="instrument"?classname="org.hibernate.tool.instrument.InstrumentTask">
    ????????
    <classpath?path="${jar.path}"/>
    ????????
    <classpath?path="${classes.dir}"/>
    ????????
    <classpath?refid="lib.class.path"/>
    ????
    </taskdef>

    ????
    <instrument?verbose="true">
    ????????
    <fileset?dir="${testclasses.dir}/org/hibernate/auction/model">
    ????????????
    <include?name="*.class"/>
    ????????
    </fileset>
    ????
    </instrument>
    </target>

    Please note that this is mostly a marketing feature, as in practice, optimizing row reads is much more important than optimization of column reads.

    debug麻煩, 并沒有測試

    2. use hql

    //?use?vo
    String?hql?=?"select?new?Foo(f.id,?f.name)?from?Foo?f";

    //?use?map?
    String?hql?=?"select?new?map(f.id,?f.name)?from?Foo?f";

    //?use?Object[]
    String?hql?=?"select?f.id,?f.name?from?Foo?f";

    //?use?list
    String?"select?new?list(f.id,?f.name)?from?Foo?f";
    不支持嵌套的對象, 不爽, 如
    String?hql?=?"select?new?Foo(f.id,?new?Bar(f.bar.id,?f.bar.name))?from?Foo?f";


    以上兩種方法在實際應用中都不是很理想, 但那種from Pojo的方式太浪費內存, 遇到blob字段更可怕, 有其他更好方法的請告知

    posted on 2006-04-10 20:28 waterye 閱讀(2014) 評論(1)  編輯  收藏 所屬分類: hibernate

    Feedback

    # re: hibernate的column級lazy 2007-04-08 21:41 rason

    采用Hibernate annotation(JPA)
    @Lob
    @Basic(fetch=LAZY)
    private byte[] fileContent;  回復  更多評論   

    主站蜘蛛池模板: 3344在线看片免费| 日日狠狠久久偷偷色综合免费| 久久九九全国免费| 亚洲综合在线另类色区奇米| 久久国产一片免费观看| 亚洲中文字幕久久精品无码APP| 精选影视免费在线 | 亚洲无码在线播放| 黄色免费在线网站| 综合自拍亚洲综合图不卡区| 免费A级毛片无码无遮挡内射| 亚洲日本国产乱码va在线观看| 一二三四视频在线观看中文版免费| 亚洲精品美女网站| 国产免费午夜a无码v视频| 色多多免费视频观看区一区| 国产亚洲精品精品国产亚洲综合| 91视频免费观看| 亚洲美女视频免费| 午夜寂寞在线一级观看免费| 窝窝影视午夜看片免费| 亚洲AV无码久久精品狠狠爱浪潮| 亚洲精品视频免费看| 无码亚洲成a人在线观看| 国产亚洲日韩一区二区三区| 一级毛片在线免费看| 亚洲熟女综合色一区二区三区| 亚洲第一永久AV网站久久精品男人的天堂AV | 亚洲AV无一区二区三区久久| 在线观看www日本免费网站| 亚洲欧美第一成人网站7777| 亚洲精品无码激情AV| 99re热精品视频国产免费| 亚洲中文字幕无码av| 亚洲国产成人久久综合碰| 午夜老司机永久免费看片| 亚洲精品天堂在线观看| 亚洲精品国产品国语在线 | a级毛片无码免费真人| 一级毛片高清免费播放| 亚洲午夜免费视频|