Hibernate 属性 在 ORA-01445 中获取结果
Hibernate property fetch results in ORA-01445
ORA-01445: cannot select ROWID from, or sample, a join view without a key-preserved table
我在 class 中有这种属性,设置为急切获取。
@ManyToOne(targetEntity = StudentImpl.class, fetch = FetchType.EAGER)
@JoinColumn(name = "STUDENT_ID")
private Student student;
但是 oracle 结果为 ORA-01445。我注意到这是因为 select 语句很长。当我把 fetch attribute 改为 lazy 时,没有报错 thrown.The Student class 也有 eagerly fetched 的属性。我需要直接访问 属性 而无需再次查询。例如 subject.getStudent()
。我用的是oracle 10g版本10.1.0.4.2.
是Oracle端的bug吗?关于这个问题有什么建议吗?
谢谢。
是的,这是 bug in Oracle:
Bug 4369235 ANSI joins may fail with ORA-1445
Affects: Product (Component), Oracle Server (Rdbms)
Range of versions believed to be affected: Versions < 11
Versions confirmed as being affected:
9.2.0.6,
10.1.0.4,
10.2.0.1,
Platforms affected: Generic (all / most platforms affected)
Fixed: This issue is fixed in
9.2.0.8 (Server Patch Set),
10.1.0.5 (Server Patch Set),
10.2.0.2 (Server Patch Set), 11g
Symptoms: Related To: Error May Occur ORA-1445 ANSI Joins
Description: ORA-1445 can occur for ANSI join queries with large
views/subqueries.
这似乎也是因为另一个 bug in Oracle。确保参与查询的所有表都声明了主键(唯一的 constraint/index 不足以解决此问题)。
那么,你是怎么解决这个问题的?好吧,对于每个错误,正确的解决方案是将软件升级到错误已修复的版本(在这里,您应该升级数据库)。如果这不是一个选项,那么您别无选择,只能调整您的代码以避免使用错误功能(更改您的查询、映射等)。
例如,我提供的 link 中建议的解决方法之一是将连接数限制为 6,因此您可以尝试相应地重写 query/mappings(您已经找到类似的解决方法)。
ORA-01445: cannot select ROWID from, or sample, a join view without a key-preserved table
我在 class 中有这种属性,设置为急切获取。
@ManyToOne(targetEntity = StudentImpl.class, fetch = FetchType.EAGER)
@JoinColumn(name = "STUDENT_ID")
private Student student;
但是 oracle 结果为 ORA-01445。我注意到这是因为 select 语句很长。当我把 fetch attribute 改为 lazy 时,没有报错 thrown.The Student class 也有 eagerly fetched 的属性。我需要直接访问 属性 而无需再次查询。例如 subject.getStudent()
。我用的是oracle 10g版本10.1.0.4.2.
是Oracle端的bug吗?关于这个问题有什么建议吗?
谢谢。
是的,这是 bug in Oracle:
Bug 4369235 ANSI joins may fail with ORA-1445
Affects: Product (Component), Oracle Server (Rdbms)
Range of versions believed to be affected: Versions < 11
Versions confirmed as being affected: 9.2.0.6, 10.1.0.4, 10.2.0.1,
Platforms affected: Generic (all / most platforms affected)
Fixed: This issue is fixed in 9.2.0.8 (Server Patch Set), 10.1.0.5 (Server Patch Set), 10.2.0.2 (Server Patch Set), 11g
Symptoms: Related To: Error May Occur ORA-1445 ANSI Joins
Description: ORA-1445 can occur for ANSI join queries with large views/subqueries.
这似乎也是因为另一个 bug in Oracle。确保参与查询的所有表都声明了主键(唯一的 constraint/index 不足以解决此问题)。
那么,你是怎么解决这个问题的?好吧,对于每个错误,正确的解决方案是将软件升级到错误已修复的版本(在这里,您应该升级数据库)。如果这不是一个选项,那么您别无选择,只能调整您的代码以避免使用错误功能(更改您的查询、映射等)。
例如,我提供的 link 中建议的解决方法之一是将连接数限制为 6,因此您可以尝试相应地重写 query/mappings(您已经找到类似的解决方法)。