`

lazy=true

阅读更多

       
        <!--考虑到 性能问题,请保持lazy的值为true,此时只能得到attachs中对象的Id值 ,若要得到其它属性值,请通过id再做查询-->
        <set name="attachs"  inverse="true" lazy="true" fetch="join">
            <key>
                <column name="TEXTID" not-null="true"/>
            </key>
            <one-to-many class="net.p5w.common.po.ircs.IrcsNewsAttach"/>
        </set> 

 

 

-----------------------------------------

 public IrcsNews findById(Long ircsNewsId) {
  IrcsNews news=this.ircsNewsDAO.findById(ircsNewsId);
  
  if(!CollectionUtils.isEmpty(news.getAttachs())){
   news.getAttachs().iterator().next();
  }

  return news;
 }

 

通过粗体字的方法,返回的对象就已经加载了set中的对象。。

 

分享到:
评论

相关推荐

    当设置lazy=true时,怎样使用extjs和Hibernate

    NULL 博文链接:https://afuer.iteye.com/blog/1508008

    spring中lazy=“true”的正常读取关联表(用opensessioninview)

    NULL 博文链接:https://likenice.iteye.com/blog/290162

    Vue+ElementUI 中级联选择器Bug问题的解决

    最近在项目中需要用到级联这么个控件,所以便去element上找了个,发现了个问题,在这里跟大家分享下,介于公司项目的隐私性,所以一些文字便给大家打上马赛克了,敬请谅解~ 不多说废话,直接上问题: ...

    LMVC 可用于实际项目中.非常方便

    对之前那个包进行了升级。增加了延迟初始化的功能( @Action(action="login",lazy=true) ).可用于实际项目中 有兴趣的来群41229007啊

    Spring IOC Bean标签属性介绍(教学视频+源代码)

    1.4 当 Scope="singleton" 且 lazy-init="true" 时 1.5 当scope="prototype"时 1.6 当scope="prototype" 且 lazy-init="true" 时 1.7 小结 1.8 depends-on 1.8.0 实体类JavaBean 1.8.0.1 Student类 1.8.1 配置文件都...

    protobuf-2.4.1懒解析补丁

    如果发现你的protobuf编解码占用了大部分的CPU,那么可以试用下这个补丁,该补丁使protoc能够识别message的lazy选项,并且生成对应的懒解析代码。... optional foo f = 1[lazy=true]; } 欢迎您提出宝贵的意见和建议。

    mySQL 延迟 查询主表

    在主外键表存在关系的时候如果加上"lazy=true"的话,则表明延迟,即只查询主表中的内容,而不查询外键表中的内容。

    JPA例子(里面有一对一,一对多的例子)

    @JoinColumn(name = "personid", unique = false, nullable = true, insertable = true, updatable = true) public Person getPerson() { return this.person; } public void setPerson(Person person) { ...

    ink-lazyload:一个真正的异步懒加载器由懒惰的编码器制作

    # .EXT.LazyLoad 一个真正的异步惰性加载器,由惰性编码器制作。... requireModules ( [ 'Ink.Ext.LazyLoad_1' ] , function ( Lazy ) { var Lazy = new Lazy ( { 'delay' : 200 'failretry' : true ,

    sbt-modules:简化模块创建的SBT插件

    简化模块创建的SBT插件 - skip in publish := true- lazy val docs = project- .settings(skip in publish := true)- .dependsOn(allProjects: _*)+ .dependsOn(allModules: _*) .in(file&#40;"docs"&#41;)+ lazy ...

    sdmx.py:使用 Python 读取 SDMX XML 文件

    数据交换读取 SDMX XML 文件。 我只添加了我需要的功能,所以这远不是一个彻底的实现。 欢迎投稿。安装pip install sdmx 用法sdmx.generic_data_message_reader(fileobj, ... lazy : 设置为True以延迟读取观察,以允许

    HelloSpring.zip

    我的博客中“maven环境搭建及Spring入门”的项目代码。在idea中运行成功。 1。创建IOC容器 2。通过xml装配对象 【简单类型用value、复杂(引用类型)用ref、数组,集合,Map的装配】 ...default-lazy-init=true

    hexo-lazyload-image:用于Hexo的lazyload图像插件

    hexo-lazyload-image hexo-lazyload-image是... lazyload : enable : true onlypost : false # optional loadingImg : # optional eg ./images/loading.gif isSPA : false # optional preloadRatio : 3 # optional, de

    xiaoxiaoxiao_lazyload-实现微信小程序图片懒加载特效.zip

     productArr[index].Image : 'default.jpg'}}"&gt;思路很明显,一开始arr[index]中都是false,所以默认都是default图片但是随着往下移动,有些arr[index]的值变为true,所以替换默认图片js代码:for (var i = 0;...

    hibernate总结

    &lt;set name="emps" inverse ="true" lazy="true" cascade="none" batch-size="2" fetch="join" &gt; &lt;column name="deptid" /&gt; &lt;one-to-many class="org.wllt.www.po.Emp" /&gt; Hibernate映射多对一: ...

    svg-to-inline:Web组件,用于在外部请求SVG文件并使用内联

    SVG内联 LIKED ? Leave a : ... lazy =" true " class-Name =" my-class other-class " loading-Label =" Loading " &gt; &lt;/ svg-to-inline &gt; 贡献 。 执照 SVG到Inline是根据的条款发布的。

    activemq配置

    &lt;bean id="oracle-ds" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" lazy-init="true"&gt; &lt;property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/&gt; ...

    springmvcmybatis

    &lt;bean id="writeDataSource" class="com.alibaba.druid.pool.DruidDataSource" destroy-method="close" init-method="init" lazy-init="true"&gt; &lt;property name="driverClassName" value="${jdbc.driver}" /&gt; ...

    jQM-MVC-Lazy-Loader:用于延迟加载模块的 jQuery Mobile 的超轻量级 MVC。 “app”对象上有一些辅助方法来帮助 UI 开发

    #jQM-Lazy-Loading-MVC ###目录 ##Purpose 轻量级 jQuery Mobile MVC-ish 延迟加载库。 使项目创建快速简便。 延迟加载控制器和视图。 模型留给开发人员。 辅助方法提供快速简便的 UI 功能。 ####Notes 这并...

    zxcvbn-swift

    zxcvbn-swift ... 。 zxcvbn-swift与Carthage和(希望很快)与SPM zxcvbn-swift因此更易于集成。 安装 使用。 请按照指示 ...用法 使用zxcvbn-swift一种方法是使用DBPasswordStrengthMeter 。... isSecureTextEntry = true

Global site tag (gtag.js) - Google Analytics