java-design-patterns
java-design-patterns copied to clipboard
Identity Field pattern
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:
- Unique Identifier: Each object is assigned a unique identifier, typically a primary key in the database.
- Field Mapping: The identifier field in the object corresponds to a unique column in the database table.
- Object Persistence: Ensures that the unique identifier is consistently used when saving and retrieving objects from the database.
References
- Martin Fowler's Identity Field
- Source Code Examples - Identity Field Pattern
- Project Contribution Guidelines
Acceptance Criteria
- Unique Identifier Implementation: Each domain object must have a unique identifier field that maps to the primary key in the database.
- Persistence Mechanism: Implement a mechanism to ensure that objects are saved and retrieved using their unique identifiers, maintaining consistent identity across sessions.
- Unit Tests: Provide comprehensive unit tests to validate the correct assignment, persistence, and retrieval of the unique identifiers for domain objects.
I would like to work on it
Ok @lanxiang1234, go ahead!
Please indicate if you are still working on this issue @lanxiang1234
This issue is free for taking again.
hi, can I work on this issue?
Sure @lkpengcs, I'll assign it to you
@lkpengcs are you working on it?
Hi, can I work on it?
Assigned to @YuechenL-Kristy
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.
@YuechenL-Kristy, hopefully you find time to address the review comments and we can complete this issue?
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?
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 (:
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.