java如何在HQL中转义HQL特殊列“index”
我有这样的实体:
class Index{
}
class Foo {
@OneToMany
@JoinColumns{....}
private Set<Bar> bars;
}
class Bar{
@ManyToOne
@JoinColumn(name="index_id")
private Index index;
}
如果我写HQL^{
from Foo foo
join fetch foo.bars bar
join fetch bar.index
Hibernate假设“index”是bar
的集合索引,如foo.bars
,这会导致类似以下情况的异常
org.springframework.orm.hibernate3.HibernateSystemException: Property index does not exist in collection foo.Foo.bars;
nested exception is org.hibernate.MappingException: Property index does not exist in collection foo.Foo.bars
我是否可以告诉Hibernate,我不是在寻找那个“特殊”属性,而是在寻找我映射的普通字段
(我已经阅读了前面的几个问题,这些问题涉及使用反勾号或方括号转义关键字。但是,它们只适用于作为关键字的映射列。在我的情况下,它不起作用)
共 (0) 个答案