@transient
@Transient is a persistence annotation that marks a property or field to be excluded from storage.
Spring in Action, Sixth Edition
@Transient is a Spring Data MongoDB annotation that excludes a domain property from document persistence.
- How it is used
- Excludes domain properties from persistence in MongoDB documents and R2DBC orders.
- How deep it goes
- Defines the mapping effect and works through an R2DBC relationship that would otherwise cause an error.
- Examples
- Uses a TacoOrder collection that holds Taco objects while their IDs are persisted.
- What you can do after
- Apply it to keep an R2DBC order collection available in memory without asking R2DBC to persist that relationship.
Read how Spring in Action, Sixth Edition explains @transient →
Java Persistence with Spring Data and Hibernate epub
The JPA Transient annotation marks a persistent-class field or property that must not be stored in persistent data.
- How it is used
- Excludes derived, sensitive, or environment-specific fields from JPA or Spring Data MongoDB persistence.
- How deep it goes
- Explains field or getter placement, access strategy, and the distinction from Java transient, but not provider internals.
- Examples
- Uses a computed price, a clear-text password, a local IP address, and a MongoDB User entity.
- What you can do after
- Apply it via JPA or Spring Data MongoDB to keep runtime-only fields out of stored data.
Read how Java Persistence with Spring Data and Hibernate epub explains @transient →
Related concepts
- Spring Data R2DBCconfigures · Spring Data R2DBC is a Spring Data project that provides repository-based persistence for relational databases through the Reactive Relational Database Connectivity API.
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.

