persistence icon indicating copy to clipboard operation
persistence copied to clipboard

JPA support for sql WITH clause

Open markus183 opened this issue 5 years ago • 1 comments

Support for the sql WITH clause is missing from JPA. It would be great if the WITH clause is supported in both JPQL and the Criteria API. At the moment it can only be used in native queries (as far as i know).

The WITH clause is a excellent way to simplify and organize complex SQL queries. It has many benefits including readability and re-usage of sql snippets. I think the Criteria API could benefit from this and be more user friendly.

markus183 avatar Jun 05 '20 11:06 markus183

I agree that CTEs should be added to JPA. For now, you can use Blaze-Persistence if you really need this for e.g. recursive CTEs: https://persistence.blazebit.com/documentation/core/manual/en_US/index.html#recursive-ctes

beikov avatar Jun 05 '20 11:06 beikov