Skip to content
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions spec/src/main/asciidoc/repository.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ Support for stateful repositories is defined in the dedicated module `jakarta.da

==== Persistence contexts

A stateful repository is backed by a _persistence context_, a set of managed entity instances in which at most one instance represents a given record in the database.
A stateful repository operation applies to a _persistence context_, a set of managed entity instances in which at most one instance represents a given record in the database. Persistence context can span multiple repository operations, such as all operations performed within a transaction.
Comment thread
njr-11 marked this conversation as resolved.
Outdated

- An entity instance never belongs to multiple persistence contexts.

Expand All @@ -1009,7 +1009,7 @@ A stateful repository is backed by a _persistence context_, a set of managed ent

- A persistence context is never shared across transactions.

A query method of a stateful repository which returns an entity type always returns managed instances belonging to the persistence context associated with the repository.
A query method of a stateful repository which returns an entity type always returns managed instances belonging to the persistence context in which the repository operation is running.
Comment thread
njr-11 marked this conversation as resolved.
Outdated

[WARNING]
====
Expand All @@ -1020,7 +1020,7 @@ This specification does not define the lifecycle of a persistence context, nor h

[NOTE]
====
Implementations of Jakarta Data are encouraged to propagate a single persistence context within a given transaction across repositories which share a given datasource.
Implementations of Jakarta Data are encouraged to propagate a single persistence context within a given transaction across repositories which share a given data store.
For example, a Jakarta Data provider backed by an implementation of Jakarta Persistence might take advantage of standard Jakarta EE transaction-scoped persistence context propagation.
====

Expand All @@ -1031,7 +1031,7 @@ A <<Lifecycle methods, lifecycle method>> of a stateful repository must be annot
The annotations `@Save`, `@Insert`, `@Update`, `@Delete` are used to define stateless repositories and must not be used to declare lifecycle methods of a stateful repository.
Instead, this specification defines the special lifecycle annotations `@Persist`, `@Merge`, `@Refresh`, `@Remove`, and `@Detach` for declaring lifecycle methods of stateful repositories.

A lifecycle method annotated `@Remove` or `@Refresh` only accepts managed entities associated with the persistence context underlying the repository.
A lifecycle method annotated `@Remove` or `@Refresh` only accepts managed entities associated with the persistence context under which the repository method is running.
Comment thread
njr-11 marked this conversation as resolved.
Outdated
On the other hand, a method annotated `@Persist`, `@Merge`, or `@Detach` also accepts unmanaged entities.

==== Automatic change detection
Expand Down