How can I utilise the same association more than once in HQL?

I primarily utilise Spring Data JPA and Java with Spring Boot.

There are two tables, A and B, in an existing database, with B having a foreign key referring to A.

I have the 2 entities in my code.Preformatted text
@Table(schema = “TEST”, name = “A”)
public class Deliver implements Serializable {

@OneToMany(cascade = CascadeType.ALL, mappedBy = "deliver")
private List<B> parameters;


@Table(schema = “TEST”, name = “B”)
public class Parameters implements Serializable {


I want to run the following SQL query through HQL:
select a.ID
from A a
join B b as b1 on a.ID = b1.A_ID
join B b as b2 on a.ID = b2.A_ID
join B b as b3 on a.ID = b3.A_ID
where b1.type = ‘Client’ and b1.value = ‘INDIA’
and b2.type = ‘Site’ and b2.value = ‘BENGALURU’
and b3.type = ‘Laboratory’ and b3.value = ‘CHEMISTRY’;
The issue is that I only have a single @OneToMany relationship between entities A and B, however in my scenario, I want to join entity Deliver’s table B three times using this relationship (table A).


Are you utilizing GroupDocs.Conversion in your application one way or other? Could you please share the issue that you are facing with the Conversion API?

Thank you for your response, I will share in that category.


You are welcome.