iluwatar / java-design-patterns

Design patterns implemented in Java
https://java-design-patterns.com
Other
89.64k stars 26.51k forks source link

Identity Field pattern #1298

Open iluwatar opened 4 years ago

iluwatar commented 4 years ago

Description

The Identity Field design pattern ensures that each object in a system has a unique identifier, which can be used to track the object independently of its database representation. This pattern is particularly useful in systems where objects need to be reconstituted from a persistent storage medium, ensuring that each object retains its unique identity across different sessions and operations.

Main Elements of the Pattern:

  1. Unique Identifier: Each object is assigned a unique identifier, typically a primary key in the database.
  2. Field Mapping: The identifier field in the object corresponds to a unique column in the database table.
  3. Object Persistence: Ensures that the unique identifier is consistently used when saving and retrieving objects from the database.

References

Acceptance Criteria

  1. Unique Identifier Implementation: Each domain object must have a unique identifier field that maps to the primary key in the database.
  2. Persistence Mechanism: Implement a mechanism to ensure that objects are saved and retrieved using their unique identifiers, maintaining consistent identity across sessions.
  3. Unit Tests: Provide comprehensive unit tests to validate the correct assignment, persistence, and retrieval of the unique identifiers for domain objects.
lanxiang1234 commented 3 years ago

I would like to work on it

iluwatar commented 3 years ago

Ok @lanxiang1234, go ahead!

iluwatar commented 2 years ago

Please indicate if you are still working on this issue @lanxiang1234

iluwatar commented 2 years ago

This issue is free for taking again.

lkpengcs commented 2 years ago

hi, can I work on this issue?

iluwatar commented 2 years ago

Sure @lkpengcs, I'll assign it to you

iluwatar commented 2 years ago

@lkpengcs are you working on it?

YuechenL-Kristy commented 2 years ago

Hi, can I work on it?

iluwatar commented 2 years ago

Assigned to @YuechenL-Kristy

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

iluwatar commented 1 year ago

@YuechenL-Kristy, hopefully you find time to address the review comments and we can complete this issue?

ASHUdev05 commented 1 year ago

I would like to work on this issue and finally complete it after so many inactive attempts (: Can this be assigned to me under hacktoberfest label?

ASHUdev05 commented 1 year ago

Can the PR be reviewed if possible? I am actually speed running hacktoberfest so if this gets on time I will be on target count (:

stale[bot] commented 10 months ago

This issue has been automatically marked as stale because it has not had recent activity. The issue will be unassigned if no further activity occurs. Thank you for your contributions.