`

2010.04.08———cannot simultaneously fetch multiple bags异常

阅读更多
2010.04.08———cannot simultaneously fetch multiple bags异常


Caused by: org.hibernate.HibernateException: cannot simultaneously fetch multiple bags,


用户登录时,同步实时加载用户的角色对象、权限对象,而往往这些关系都是多对多关系,就单一列内容来看存在重复的值,从而引起multiple bags。我在网上搜索这类结果,几乎都提出一个解决办法——采用延迟加载,即fetch=FetchType.LAZY,这样就束缚了框架的强大功能

问题原因就是,当持久框架抓取一方的对象时,同时加载多方的对象放进容器中,多方又可能与关联其它对象,Hibernate实现的JPA,默认最高抓取深度含本身级为四级(它有个属性配置是0-3),若多方(第二级)存在重复值,则第三级中抓取的值就无法映射,按照这个道理,就应该报出无法同时加载多个包之异常

一对多或多对多的多方数据抓取过来后必须用容器类存,例如Set、List、Map等,主要就在这个容器上

即@ManyToMany或@OneToMany的Many方此时一定用Set容器来存放,而不能用List集合。














分享到:
评论
2 楼 weir2009 2011-01-15  
延迟加载还是要的,
问题是出在这里:
即@ManyToMany或@OneToMany的Many方此时一定用Set容器来存放,而不能用List集合。
1 楼 fendoubattier 2010-09-24  
如果是延时加载的问题的话,那只要我关闭延时加载按理论上是没问题的啊,为什么我关闭了延时加载,仍然出同样的错?

相关推荐

    python图片采样(csdn)————程序.pdf

    以便更好地适应机器学习模型,比如阴影检测、水体检测或覆盖物检测,因为提到了“using the checkpoints to get result of shadow, water and layover simultaneously”。然而,由于没有具体使用 TensorFlow,这可能...

    MBAXP Modbus ActiveX Control

    You can communicate with multiple ports simultaneously. See the Quick Start Guide. MBAXP Technical Facts and Features: RTU Mode. ASCII Mode. Modbus TCP/IP. Multi-threaded for high data throughput. ...

    Edirol.HQ.Orchestral.VSTi.v1.03-TALiO

    罗兰的经典音色库,小且实用。 Note: This release contains only the VSTi as it is the only component updated in v1.03. Orchestral instruments come alive with ... several audio devices...simultaneously!

    Beginning ASP.NET 2.0 in C# 2005:From Novice to Professional

    You will learn language and theory simultaneously, mastering the core techniques necessary to develop good coding practices and enhance your skill set. This book provides thorough coverage of ASP.NET...

    08年英语六级核心词汇-副词+名词

    08年英语六级核心词汇-副词+名词  deliberately ad. 故意,有意地  deliberately ad. 深思熟虑地,审慎地  exclusively ad. 仅仅地  explicitly ad. 明确地  forcibly ad. 强行地,有力地  formerly ad. ...

    FlexGraphics_V_1.79_D4-XE10.2_Downloadly.ir

    - ADD: Delphi/CBuilder 2010 now supported. - ADD: Delphi/CBuilder 2009 now supported. - ADD: New demo project FlexCADImport. - FIX: The height of the TFlexRegularPolygon object incorrectly changes ...

    lab04.pdf

    The main challenge in solving BVPs is finding a solution that satisfies both boundary conditions simultaneously. Unlike initial value problems where we have a unique solution, BVPs often have ...

    Bullet Physics For Unity.unitypackage

    * Simulate multiple physics worlds simultaneously * Simulations independent of game loop * Access to every byte of source code * Softbodies, ropes, cables and cloth * Featherstone inverse dynamics * ...

    plsqldev14.0.0.1961x64多语言版+sn.rar

    You can now display multiple result sets simultaneously and can compare them: CLOBs and BLOBs are now fetched on demand to improve query performance. Single record view will now show column comments ...

    RunAsDate.exe

    支持一些软件试用期的破解。...You can run multiple applications simultaneously, each application works with different date and time, while the real date/time of your system continues to run normally.

    HDL Works HDL Desing Entry EASE v8.2.R2

    EASE offers the best of both worlds ... Industry standard version control environments deal with design and configuration management enabling multiple users to work simultaneously on one EASE project.

    Professional C#4.0 and .NET 4.0 part2

    Published simultaneously in Canada ISBN: 978-0-470-50225-9 Part i: The C# language Chapter 1: .NET Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Chapter 2: Core C# . . . . . ....

    Professional C# 4.0 and .NET 4.0 part1

    Published simultaneously in Canada ISBN: 978-0-470-50225-9 Part i: The C# language Chapter 1: .NET Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Chapter 2: Core C# . . . . . ....

    Pandas Cookbook 2017 pdf 2分

    Selecting DataFrame rows and columns simultaneously Getting ready How to do it... How it works... There's more... Selecting data with both integers and labels Getting ready How to do it... How it ...

    Novel algorithm for simultaneously detecting multiple vapor materials with multiple-wavelength differential absorption lidar

    Differential absorption lidar (DIAL) has ... In this paper, a simple and accurate algorithm is presented for simultaneously detecting and estimating multiple vapor materials with multiple-wavelength DI

    Addison.Wesley.The.Java.Programming.Language.4th.Edition.Aug.2005.chm

    Many applications, such as graphical interfacebased software, must attend to multiple tasks simultaneously. These tasks must cooperate to behave correctly, and threads meet the needs of cooperative ...

    hibernate-shards.jar

    We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license ...

    [Excel.2007.Power.Programming.with.VBA].Excel.2007.Power.Programming.with.VBA.part1

    Published simultaneously in Canada Library of Congress Control Number: 2006939606 ISBN: 978-0-470-04401-8 0-47004-401-2 Manufactured in the United States of America 10 9 8 7 6 5 4 3 2 1 No part ...

Global site tag (gtag.js) - Google Analytics