Java / Micronaut Interview questions
What is the difference between Micronaut Data JDBC and Micronaut Data JPA?
| Micronaut Data JDBC | Micronaut Data JPA |
| Executes plain SQL directly against the database with no persistence context. | Uses Hibernate/JPA underneath, with an entity manager and persistence context. |
| No lazy loading, no dirty checking, no first-level cache. | Supports lazy loading, dirty checking, and caching via Hibernate. |
| Simpler mental model - what you write maps closely to the SQL executed. | More features, but reintroduces some of Hibernate's proxying and session overhead. |
| Generally lighter weight and a better fit for native image builds. | Heavier, though Micronaut still avoids full Hibernate reflection-based bootstrap where possible. |
Micronaut Data JDBC is often the default recommendation when startup time and GraalVM compatibility matter most, since it sidesteps Hibernate's runtime proxy generation and session management entirely, while JPA remains useful when you need Hibernate-specific features like cascading relationships or complex lazy associations.
More Related questions...