Jakarta Data and Jakarta Persistence by Gavin King

Explore Jakarta Data and Jakarta Persistence with Gavin King, covering key features like type-safe queries, repository interfaces, and cross-datastore compatibility.

Key takeaways
  • Jakarta Data is designed to work with both relational and non-relational data stores, offering a standardized API for data access

  • The specification provides type-safe query methods through annotation processing, catching errors at compile time rather than runtime

  • Repository interfaces in Jakarta Data are stateless by design, unlike traditional JPA EntityManager which maintains a persistence context

  • Jakarta Data implementations support CRUD operations and query methods without requiring custom implementations or boilerplate code

  • Queries can be defined using method names, annotations, or JDQL (Jakarta Data Query Language) - a subset of JPQL with restrictions

  • The specification supports pagination, sorting, and projection capabilities through standard interfaces and annotations

  • Type safety is achieved through annotation processors and static metamodels, providing compile-time validation of queries and entity references

  • Natural keys are preferred over synthetic keys for entities, particularly when implementing equals() and hashCode()

  • Jakarta Data is designed to be implementable across different datastores while maintaining consistent semantics

  • The specification aims to simplify data access without hiding the underlying persistence technology or introducing unnecessary abstractions

  • Repository operations are extensible, allowing implementations to add custom functionality while maintaining standard compliance