`

(转)Path expected for join!错误处理

 
阅读更多

hibernate中,进行连接查询时,如果使用join语句,就容易产生标题所示的错误。

比如from Content o left join Mcp mcp where o.mcp.id=mcp.id and mcp.id=2

正确的做法应该是在A中建立private Mcp mcp,并映射,

然后通过from Content o left join o.mcp mcp where mcp.id=2

奇怪吧,这么罗嗦。其实大可不必这样连接操作,只要from Content where mcp is null or mcp.id=2即可

 

如果在Content对象中建立mcp(对象)字段的话,就用不了join。

这时只能用from Content o,Mcp mcp where o.mcpId is null or (o.mcpId=mcp.id and mcp.id=2)

这时的mcpId是一个与Mcp表中id对应的整型

 

结论: 尽量不用join,费力不讨好。

 

 

REFS:http://blog.csdn.net/kenera/article/details/6691754

分享到:
评论

相关推荐

    path.join:连接始终返回正斜杠的路径的函数(unix 和 windows 统一)。 path.join 的替代品

    路径连接 Node JS 函数来连接总是返回正斜杠的路径(unix 和 windows 统一)。 path.join 的替代品 ###安装: npm install path.join ...//expected value for both UNIX and Windows: path/to/my/heart

    expected time bounds for selection

    通过减少不必要的比较操作,可以显著提高这些领域的处理速度和效率。 ### 论文贡献 本文的主要贡献包括: 1. 提出了一个新颖的选择算法,该算法在平均情况下表现出较高的效率。 2. 给出了选择问题的期望时间界限,...

    SN_29500-5_Part_5_Expected_values_for_electrical_connections

    SN_29500-5_Part_5_Expected_values_for_electrical_connections,_electrical_connectors_and_sockets 可靠性设计

    ABAP for all entries使用中注意的问题

    这是因为FOR ALL ENTRIES IN的机制与这些功能的处理方式存在冲突,可能引发数据处理上的错误。 ### 总结 总之,FOR ALL ENTRIES IN是ABAP编程中一个强大但需谨慎使用的工具。正确理解和应用其规则和限制,可以帮助...

    checktree例子

    print(f"Expected file missing: {os.path.join(root, expected_file)}") for expected_dir in expected_dirs: dir_path = os.path.join(root, expected_dir) if not os.path.isdir(dir_path): print(f...

    for语句递归下降法

    在编程语言的解析领域,编译原理是一门关键的课程,它涉及到如何将高级语言转换为机器可执行...通过这种方式,我们可以创建一个能识别和处理for语句的解析器,这对于理解编译原理和实现自己的编译器或解释器至关重要。

    matlab常见错误总结

    在MATLAB编程过程中,会遇到各种各样的错误,这些错误可能是由于语法错误、类型不匹配、文件处理不当等原因造成的。以下是一些常见的MATLAB错误及其解决办法: 1. **内存溢出 (error1: Out of memory)**:当MATLAB...

    KEIL编译错误信息

    ### KEIL编译错误信息详解 #### 一、概述 在使用KEIL进行软件开发时,我们经常会遇到各种各样的编译错误。这些错误可能是由于语法不正确、内存不足、类型不匹配等原因导致的。了解并掌握这些错误信息对于解决编程...

    expected return

    本书《expected return》是一本专著,深入探讨了投资者在投资决策中非常重要的一个概念——预期收益率。预期收益率是基于投资者对未来投资回报的估计,这不仅包括对回报的量化预测,同时也涉及到对潜在风险的评估。...

    path2d-polyfill:用于画布渲染的Polyfills Path2D API

    path2d-polyfill Polyfills Path2D API,用于在画布中呈现SVG路径 使用此功能可在Internet Explorer中启用Path2D功能。 用法 从CDN加载 [removed][removed] 或从npm安装 npm install --save path2d-polyfill 直接...

    SN-29500-9-Part-4-Expected-values-for-switches-and-buttons

    SN_29500-9_Part_4_Expected_values_for_switches_and_buttons

    西门子SN-29500-9-Part-9-Expected-values-for-switches-and-buttons

    SN_29500-9_Part_9_Expected_values_for_switches_and_buttons

    Uploadify-Script5007 Object expected 修正js

    IE下使用uploadify上传报:Uploadify-Script5007 Object expected解决方案

    systematic error handling in c++

    与异常处理相比,Expected类型减少了错误处理的性能开销,并允许异常处理机制的复用。开发者可以在代码中根据需要选择使用异常或Expected类型。Expected类型的使用使得代码更加清晰,也更易于维护。它还允许程序员...

    python pyinstaller3.4 win10补丁,修复环境变量错误

    Python3.7 在使用pyinstaller3.4打包发布可执行文件时报错:TypeError: expected str, bytes or os.PathLike object, not NoneType pyinstall。 下载后替换项目根目录下\venv\Lib\site-packages\PyInstaller\depend\...

    Figure of expected result

    Figure of expected result

    python 使用Flask 出现 ValueError: Expected object or value 问题解决

    文件与我处理数据的py文件不在同一级目录。 文件结构大致如下: project clean_data data.py test.json manager.py templates static test.json文件是与data.py文件在同一级目录下的。 所以我读取json文件的时候,...

    [水晶报表] SAP Crystal Reports Developer for VS2013 (6-4)

    Add monitoring probes that help ensure the server is behaving as expected Use Web services to perform report scheduling, storing: querying and more Extend your reporting solutions with managed BI

Global site tag (gtag.js) - Google Analytics