Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal for Enhanced Data Persistence Pattern[Vote] #459

Open
2 of 4 tasks
otaviojava opened this issue Feb 20, 2024 · 0 comments
Open
2 of 4 tasks

Proposal for Enhanced Data Persistence Pattern[Vote] #459

otaviojava opened this issue Feb 20, 2024 · 0 comments
Labels
enhancement New feature or request vote Something to vote on

Comments

@otaviojava
Copy link
Contributor

As a ...

  • Application user/user of the configuration itself
  • API user (application developer)
  • SPI user (container or runtime developer)
  • Specification implementer

I need to be able to ...

Building upon the Query Language Proposal (#458), this proposal suggests introducing a new Data Persistence pattern to augment the Jakarta Data Template interface. This enhancement aims to provide a more data-agnostic approach to Data Access Object (DAO) implementation, offering greater flexibility and consistency across different data storage technologies.

Which enables me to ...

The primary goal of this proposal is to initiate a discussion and a vote regarding introducing the Enhanced Data Persistence pattern into the Jakarta Data project.

Key Features:

  1. Standardized Operations: The existing Jakarta Data Template Interface offers a standardized set of methods for common database operations, ensuring consistency across the application.

  2. Template Pattern: Following the template pattern, the interface simplifies the implementation of data access logic, making it more accessible and modular.

  3. Flexibility for Data-Agnostic DAOs: The proposed pattern enriches the Template interface with additional capabilities, empowering developers to implement Data Access Objects (DAOs) in a data-agnostic manner. This flexibility allows for the seamless switching between different data storage technologies.

  4. Support for Fluent API Querying: The addition of a fluent query API enables developers to construct expressive and database-agnostic queries directly through the DAO interface, enhancing readability and maintainability.

  5. Integration with Criteria Queries: The proposal includes support for Criteria queries, enhancing the flexibility and expressiveness of data retrieval operations. Further discussion on this feature will be conducted in Issue #SOON.

Example Usage:

List<Car> cars = template
    .select(Car.class)
    .where(_Car.city.eq("Rome").and(_Car.active.isTrue()))
    .orderBy(_Car.name.asc())
    .result();

Benefits:

  1. Enhanced Productivity: The Enhanced Data Persistence pattern significantly increases productivity by reducing boilerplate code and simplifying common database operations.

  2. Consistent Data Access: Developers can rely on a consistent API for data access, promoting maintainability and ease of understanding across the application.

  3. Data-Agnostic Implementation: By decoupling DAOs from specific data storage technologies, the pattern promotes adaptability and future-proofing of the application architecture.

  4. Fluent Querying: The fluent API for querying simplifies the construction of complex and expressive queries, improving the developer's experience.

Additional information

The Jakarta Data template is tightly coupled with the Criteria proposal, which we will discuss in another issue.

@otaviojava otaviojava added enhancement New feature or request vote Something to vote on labels Feb 20, 2024
@KyleAure KyleAure added this to the Jakarta Data Future milestone Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request vote Something to vote on
Projects
None yet
Development

No branches or pull requests

2 participants