liveBook · Manning

@Id

@Id is an annotation that identifies a property or field as the persistent identity of an entity or object.

How 2 Manning books explain it

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.

Read how Spring in Action, Sixth Edition explains @Id →

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

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.