How to make LEFT JOIN in criteria api jpa without related entities?

Viewed 38

I am trying to make a LEFT JOIN in criteria api jpa without related entities (They are bound by foreign keys.). For this, I found only this option:

cb.equal(userRoot.get("userId"), productRoot.get("productId"))

But this option does INNER JOIN, which is not suitable for me.
I would be grateful for the instruction!

1 Answers

It is a problem with a difficult solution, if the cross is by ID, if there is not a very high data volume, you could make two queries, one on each table, and treat the data later with lambdas and java 8 stream, obtaining a performance Similary.

Related