java - Do left outer join only if condition satisfies in JPA -
"I am new to JPA. I am trying to do a left outer join only if a condition is satisfied. Ther is a query as below in my JPA repository. Here I would like to do A left outer join B with the where condition, only if a given flag toJoin is true in application: select a.id, a.name from A left outer join B on A.id = B.aid where b.name=""some_name"" I am not sure, how will I accommodate the toJoin application flag in the above JPA query in my JPA repository. Could anyone please help here? Thanks.
java mysql spring-boot jpa spring-data-jpa
ShareShare a link to this question Copy linkCC BY-SA 4.0
Follow Follow this question to receive notifications
edited 1 min ago Joy
asked 5 mins ago JoyJoy 3,5481111 gold badges4040 silver badges8383 bronze badges"
|