iluwatar / iluwatar/java-design-patterns

Stored Procedures for Primary Keys pattern

Open
#1,273 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

epic: pattern info: help wanted type: feature
Dominant language
Java
Stars
94.7k
Forks
27.4k
Avg merge
3d 4h
Merged PRs (30d)
10

Description

Description:
Implement the Stored Procedures for Primary Keys design pattern. This pattern centralizes the creation of primary key values in a database through stored procedures. The primary objective is to ensure unique and sequential key generation across different parts of an application. By utilizing stored procedures, this pattern enhances consistency, simplifies key management, and can improve performance by reducing the logic required in the application layer for key generation.

Main Elements:

  1. Centralized Key Generation: Use stored procedures to generate primary key values, ensuring uniqueness and sequential order.
  2. Database Consistency: Maintain consistent key generation across different application modules.
  3. Simplified Application Logic: Offload key generation logic from the application layer to the database.
  4. Performance Optimization: Reduce the overhead of key generation logic in the application, potentially improving overall performance.

References:

Acceptance Criteria:

  1. A stored procedure is created in the database to handle the generation of primary keys.
  2. The application layer is modified to call the stored procedure for primary key generation instead of generating keys within the application code.
  3. Comprehensive tests are implemented to ensure that the stored procedure generates unique and sequential primary key values and that the integration with the application is seamless.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, tests, database engine, or application entry point. Start with the Project Contribution Guidelines and the linked design-pattern source, then determine the database procedure and application integration scope. Done means a stored procedure generates unique sequential keys, the application calls it, and integration tests cover both behaviors.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, sql
Domain
backend, database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.