1
.gitignore
vendored
1
.gitignore
vendored
@@ -10,7 +10,6 @@ target/
|
||||
.DS_Store
|
||||
node_modules
|
||||
package-lock.json
|
||||
package.json
|
||||
node
|
||||
build/
|
||||
.mvn/.gradle-enterprise
|
||||
|
||||
10
spring-data-jpa-distribution/package.json
Normal file
10
spring-data-jpa-distribution/package.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"antora": "3.2.0-alpha.6",
|
||||
"@antora/atlas-extension": "1.0.0-alpha.2",
|
||||
"@antora/collector-extension": "1.0.0-alpha.7",
|
||||
"@asciidoctor/tabs": "1.0.0-beta.6",
|
||||
"@springio/antora-extensions": "1.13.0",
|
||||
"@springio/asciidoctor-extensions": "1.0.0-alpha.11"
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,7 @@
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>io.spring.maven.antora</groupId>
|
||||
<groupId>org.antora</groupId>
|
||||
<artifactId>antora-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
@@ -3,12 +3,11 @@
|
||||
# The purpose of this Antora playbook is to build the docs in the current branch.
|
||||
antora:
|
||||
extensions:
|
||||
- '@antora/collector-extension'
|
||||
- require: '@springio/antora-extensions/root-component-extension'
|
||||
- require: '@springio/antora-extensions'
|
||||
root_component_name: 'data-jpa'
|
||||
site:
|
||||
title: Spring Data JPA
|
||||
url: https://docs.spring.io/spring-data/jpa/reference/
|
||||
url: https://docs.spring.io/spring-data/jpa/reference
|
||||
content:
|
||||
sources:
|
||||
- url: ./../../..
|
||||
@@ -22,13 +21,12 @@ content:
|
||||
start_path: src/main/antora
|
||||
asciidoc:
|
||||
attributes:
|
||||
page-pagination: ''
|
||||
hide-uri-scheme: '@'
|
||||
tabs-sync-option: '@'
|
||||
chomp: 'all'
|
||||
extensions:
|
||||
- '@asciidoctor/tabs'
|
||||
- '@springio/asciidoctor-extensions'
|
||||
- '@springio/asciidoctor-extensions/javadoc-extension'
|
||||
sourcemap: true
|
||||
urls:
|
||||
latest_version_segment: ''
|
||||
@@ -38,5 +36,5 @@ runtime:
|
||||
format: pretty
|
||||
ui:
|
||||
bundle:
|
||||
url: https://github.com/spring-io/antora-ui-spring/releases/download/v0.3.3/ui-bundle.zip
|
||||
url: https://github.com/spring-io/antora-ui-spring/releases/download/v0.4.16/ui-bundle.zip
|
||||
snapshot: true
|
||||
|
||||
@@ -5,8 +5,16 @@ nav:
|
||||
- modules/ROOT/nav.adoc
|
||||
ext:
|
||||
collector:
|
||||
- run:
|
||||
command: ./mvnw test-compile
|
||||
local: true
|
||||
- run:
|
||||
command: ./mvnw validate process-resources -pl :spring-data-jpa-distribution -am -Pantora-process-resources
|
||||
local: true
|
||||
scan:
|
||||
dir: spring-data-jpa-distribution/target/classes/
|
||||
dir: spring-data-jpa-distribution/target/classes
|
||||
- run:
|
||||
command: ./mvnw package -Pdistribute
|
||||
local: true
|
||||
scan:
|
||||
dir: target/antora
|
||||
|
||||
@@ -32,4 +32,5 @@
|
||||
** xref:envers/configuration.adoc[]
|
||||
** xref:envers/usage.adoc[]
|
||||
|
||||
* https://github.com/spring-projects/spring-data-commons/wiki[Wiki]
|
||||
* xref:attachment$api/java/index.html[Javadoc,role=link-external, window=_blank]
|
||||
* https://github.com/spring-projects/spring-data-commons/wiki[Wiki,role=link-external, window=_blank]
|
||||
|
||||
@@ -19,7 +19,7 @@ Spring Data JPA offers the following strategies to detect whether an entity is n
|
||||
If the identifier property is `null`, then the entity is assumed to be new.
|
||||
Otherwise, it is assumed to be not new.
|
||||
2. Implementing `Persistable`: If an entity implements `Persistable`, Spring Data JPA delegates the new detection to the `isNew(…)` method of the entity. See the link:$$https://docs.spring.io/spring-data/data-commons/docs/current/api/index.html?org/springframework/data/domain/Persistable.html$$[JavaDoc] for details.
|
||||
3. Implementing `EntityInformation`: You can customize the `EntityInformation` abstraction used in the `SimpleJpaRepository` implementation by creating a subclass of `JpaRepositoryFactory` and overriding the `getEntityInformation(…)` method accordingly. You then have to register the custom implementation of `JpaRepositoryFactory` as a Spring bean. Note that this should be rarely necessary. See the link:$$https://docs.spring.io/spring-data/data-jpa/docs/current/api/index.html?org/springframework/data/jpa/repository/support/JpaRepositoryFactory.html$$[JavaDoc] for details.
|
||||
3. Implementing `EntityInformation`: You can customize the `EntityInformation` abstraction used in the `SimpleJpaRepository` implementation by creating a subclass of `JpaRepositoryFactory` and overriding the `getEntityInformation(…)` method accordingly. You then have to register the custom implementation of `JpaRepositoryFactory` as a Spring bean. Note that this should be rarely necessary. See the javadoc:org.springframework.data.jpa.repository.support.JpaRepositoryFactory[JavaDoc] for details.
|
||||
|
||||
Option 1 is not an option for entities that use manually assigned identifiers and no version attribute as with those the identifier will always be non-`null`.
|
||||
A common pattern in that scenario is to use a common base class with a transient flag defaulting to indicate a new instance and using JPA lifecycle callbacks to flip that flag on persistence operations:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[[transactions]]
|
||||
= Transactionality
|
||||
|
||||
By default, methods inherited from `CrudRepository` inherit the transactional configuration from link:$$https://docs.spring.io/spring-data/data-jpa/docs/current/api/org/springframework/data/jpa/repository/support/SimpleJpaRepository.html$$[`SimpleJpaRepository`].
|
||||
By default, methods inherited from `CrudRepository` inherit the transactional configuration from javadoc:org.springframework.data.jpa.repository.support.SimpleJpaRepository[].
|
||||
For read operations, the transaction configuration `readOnly` flag is set to `true`.
|
||||
All others are configured with a plain `@Transactional` so that default transaction configuration applies.
|
||||
Repository methods that are backed by transactional repository fragments inherit the transactional attributes from the actual fragment method.
|
||||
|
||||
Reference in New Issue
Block a user