Software Engineering Architecture Lab

Identity Field Pattern

Keep the database id inside the object. An object-relational pattern in the Enterprise Application Patterns catalog. With Java/Spring code.

Keep the database id inside the object.

Family
Enterprise Application Patterns
Category
Object-Relational
Source
Martin Fowler — Patterns of Enterprise Application Architecture

More object-relational patterns

  • Unit of Work — Track changed objects and write them in one transaction.
  • Identity Map — Load each database row into at most one object per session.
  • Lazy Load — Delay loading data until it is actually needed.
  • Repository — A collection-like interface for accessing domain objects.
  • Foreign Key Mapping — Map object references to foreign keys between tables.
  • Single Table Inheritance — Store a class hierarchy in one table with a type column.

All patterns