下面是 HQL 查询,当我在 Collection 属性上使用带有 ON 子句的联接操作时,它给了我语法错误。
我有一个 Source.java 文件,其中包含 Customer bean 的一个 Collection 属性,其中 OneToMany 映射由 Customer bean 中的源属性映射。
HQL 查询:
select s.name from Source s
join Customer c on s.customer.id = c.id
Java 类片段:
@OneToMany(mappedBy = "source")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
private Set<Customer> customer = new HashSet<>();
I have Customer.java which has ManyToOne relation with Source bean
@ManyToOne
@JoinColumn(name="source_id")
private Source source;