HQL query for Collection using ON clause

107 Views Asked by At

Below is the HQL query which gives me the syntax error when I use join Operation with ON clause on the Collection property.

I have a Source.java file with one Collection property of the Customer bean with OneToMany mapping which is mapped by source property in Customer bean.

HQL Query :

select s.name from Source s 
join Customer c on s.customer.id = c.id

Java class snippet:

    @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;
    
0

There are 0 best solutions below