@Id
@Id is an annotation that identifies a property or field as the persistent identity of an entity or object.
Spring in Action, Sixth Edition
@Id is a Spring Data JDBC annotation that marks a domain-property field as the persistent identity of an object.
- How it is used
- Marks the property that identifies a persisted domain object, row, or document.
- How deep it goes
- Explains placement, supported identifier examples, and namespace differences, but does not detail identifier-generation internals.
- Examples
- Uses TacoOrder, Taco, Ingredient, and IngredientRef classes with Long or String identity properties.
- What you can do after
- Apply the correct @Id variant to identity properties in Spring Data JDBC, JPA, or MongoDB domain types.
Java Persistence with Spring Data and Hibernate epub
@Id is the JPA annotation that marks a persistent property or field as an entity identifier.
- How it is used
- Marks the property that exposes database identity for JPA entities and Spring Data JDBC aggregates.
- How deep it goes
- Explains required identifiers, default ID mapping, field access, generated values, and explicit column mapping without covering composite identifiers.
- Examples
- Uses generated Long ids on Item and an explicitly mapped ID field on a Spring Data JDBC User.
- What you can do after
- Apply it via JPA or Spring Data JDBC to map entity identity and support identifier-based persistence and lookup.
Read how Java Persistence with Spring Data and Hibernate epub explains @Id →
Related concepts
- unique identifierconfigures · A unique identifier is a value or name that distinguishes an entity or record from others within a defined scope or namespace.
- entityconfigures · An entity is a distinct, identifiable person, object, event, or concept represented as a unit in a data, software, or semantic model.
- Spring Data JDBCused by · Spring Data JDBC is a Spring Data module that provides repository-based access to relational databases through JDBC without requiring a full object-relational mapping framework.
- Hibernateconfigures · Hibernate is a Java object-relational mapping and persistence framework that maps application objects to relational database data.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

