intermediateJPQL, Native Queries, Specifications & Criteria API

What's the tradeoff of using a native query instead of JPQL?

A native query gives full access to database-specific SQL features JPQL can't express, but sacrifices portability across JPA providers/databases and typically needs explicit result-set mapping back to entities or DTOs, unlike JPQL which maps automatically.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Continue to What's the performance difference between Page and Slice?← Back to all Spring Data JPA & Hibernate Mastery questions