Skip to content

Commit 0aee918

Browse files
committed
Polishing.
Refine navigation structure. See #3080
1 parent 065500d commit 0aee918

13 files changed

+251
-187
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ target/
1111
node_modules
1212
package-lock.json
1313
package.json
14-
node
14+
node
15+
build/

README.adoc

+6-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
image:https://spring.io/badges/spring-data-jpa/ga.svg[Spring Data JPA,link=https://projects.spring.io/spring-data-jpa/#quick-start]
2-
image:https://spring.io/badges/spring-data-jpa/snapshot.svg[Spring Data JPA,link=https://projects.spring.io/spring-data-jpa/#quick-start]
3-
41
= Spring Data JPA image:https://jenkins.spring.io/buildStatus/icon?job=spring-data-jpa%2Fmain&subject=Build[link=https://jenkins.spring.io/view/SpringData/job/spring-data-jpa/] https://gitter.im/spring-projects/spring-data[image:https://badges.gitter.im/spring-projects/spring-data.svg[Gitter]]
52

63
Spring Data JPA, part of the larger https://projects.spring.io/spring-data[Spring Data] family, makes it easy to implement JPA-based repositories.
@@ -104,7 +101,7 @@ Add the Maven dependency:
104101
<dependency>
105102
<groupId>org.springframework.data</groupId>
106103
<artifactId>spring-data-jpa</artifactId>
107-
<version>${version}.RELEASE</version>
104+
<version>${version}</version>
108105
</dependency>
109106
----
110107

@@ -115,7 +112,7 @@ If you'd rather like the latest snapshots of the upcoming major version, use our
115112
<dependency>
116113
<groupId>org.springframework.data</groupId>
117114
<artifactId>spring-data-jpa</artifactId>
118-
<version>${version}.BUILD-SNAPSHOT</version>
115+
<version>${version}-SNAPSHOT</version>
119116
</dependency>
120117
121118
<repository>
@@ -130,7 +127,7 @@ If you'd rather like the latest snapshots of the upcoming major version, use our
130127
Having trouble with Spring Data? We’d love to help!
131128

132129
* Check the
133-
https://docs.spring.io/spring-data/jpa/docs/current/reference/html/[reference documentation], and https://docs.spring.io/spring-data/jpa/docs/current/api/[Javadocs].
130+
https://docs.spring.io/spring-data/jpa/reference/[reference documentation], and https://docs.spring.io/spring-data/jpa/docs/current/api/[Javadocs].
134131
* Learn the Spring basics – Spring Data builds on Spring Framework, check the https://spring.io[spring.io] web-site for a wealth of reference documentation.
135132
If you are just starting out with Spring, try one of the https://spring.io/guides[guides].
136133
* If you are upgrading, check out the https://github.com/spring-projects/spring-data-jpa/releases[Spring Data JPA release notes] and scroll down to the one you're considering. See the details there. (Also check out the https://github.com/spring-projects/spring-data-jpa/releases/latest[latest stable release])
@@ -159,7 +156,7 @@ You also need JDK 17 or above.
159156
$ ./mvnw clean install
160157
----
161158

162-
If you want to build with the regular `mvn` command, you will need https://maven.apache.org/run-maven/index.html[Maven v3.5.0 or above].
159+
If you want to build with the regular `mvn` command, you will need https://maven.apache.org/run-maven/index.html[Maven v3.8.0 or above].
163160

164161
_Also see link:CONTRIBUTING.adoc[CONTRIBUTING.adoc] if you wish to submit pull requests, and in particular please sign the https://cla.pivotal.io/sign/spring[Contributor’s Agreement] before your first non-trivial change._
165162

@@ -169,10 +166,10 @@ Building the documentation builds also the project without running tests.
169166

170167
[source,bash]
171168
----
172-
$ ./mvnw clean install -Pdistribute
169+
$ ./mvnw clean install -Pantora
173170
----
174171

175-
The generated documentation is available from `target/site/reference/html/index.html`.
172+
The generated documentation is available from `target/antora/site/index.html`.
176173

177174
== Guides
178175

src/main/antora/antora-playbook.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ antora:
88
root_component_name: 'data-jpa'
99
site:
1010
title: Spring Data JPA
11-
url: https://docs.spring.io/spring-data-jpa/reference/
11+
url: https://docs.spring.io/spring-data/jpa/reference/
1212
content:
1313
sources:
1414
- url: ./../../..

src/main/antora/modules/ROOT/nav.adoc

+14-13
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,35 @@
11
* xref:index.adoc[Overview]
22
** xref:commons/upgrade.adoc[]
3-
* xref:repositories/introduction.adoc[]
3+
4+
* xref:jpa.adoc[]
5+
** xref:jpa/getting-started.adoc[]
46
** xref:repositories/core-concepts.adoc[]
57
** xref:repositories/definition.adoc[]
68
** xref:repositories/create-instances.adoc[]
7-
** xref:repositories/query-methods-details.adoc[]
8-
** xref:repositories/projections.adoc[]
9-
** xref:repositories/custom-implementations.adoc[]
10-
** xref:repositories/core-domain-events.adoc[]
11-
** xref:repositories/core-extensions.adoc[]
12-
** xref:repositories/null-handling.adoc[]
13-
** xref:repositories/query-keywords-reference.adoc[]
14-
** xref:repositories/query-return-types-reference.adoc[]
15-
* xref:jpa.adoc[]
16-
** xref:jpa/configuration.adoc[]
179
** xref:jpa/entity-persistence.adoc[]
10+
** xref:repositories/query-methods-details.adoc[]
1811
** xref:jpa/query-methods.adoc[]
12+
** xref:repositories/projections.adoc[]
1913
** xref:jpa/stored-procedures.adoc[]
2014
** xref:jpa/specifications.adoc[]
21-
** xref:query-by-example.adoc[]
15+
** xref:repositories/query-by-example.adoc[]
2216
** xref:jpa/transactions.adoc[]
2317
** xref:jpa/locking.adoc[]
2418
** xref:auditing.adoc[]
25-
** xref:jpa/misc-context.adoc[]
2619
** xref:jpa/misc-merging-persistence-units.adoc[]
2720
** xref:jpa/jpd-misc-cdi-integration.adoc[]
21+
** xref:repositories/custom-implementations.adoc[]
22+
** xref:repositories/core-domain-events.adoc[]
23+
** xref:repositories/null-handling.adoc[]
24+
** xref:repositories/core-extensions.adoc[]
25+
** xref:repositories/query-keywords-reference.adoc[]
26+
** xref:repositories/query-return-types-reference.adoc[]
2827
** xref:jpa/faq.adoc[]
2928
** xref:jpa/glossary.adoc[]
29+
3030
* xref:envers.adoc[]
3131
** xref:envers/introduction.adoc[]
3232
** xref:envers/configuration.adoc[]
3333
** xref:envers/usage.adoc[]
34+
3435
* https://github.com/spring-projects/spring-data-commons/wiki[Wiki]

src/main/antora/modules/ROOT/pages/jpa.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
= JPA
33
:page-section-summary-toc: 1
44

5-
This chapter points out the specialties for repository support for JPA. This builds on the core repository support explained in xref:repositories/introduction.adoc[Working with Spring Data Repositories]. Make sure you have a sound understanding of the basic concepts explained there.
5+
This chapter points out the specialties for repository support for JPA. This builds on the core repository support explained in xref:repositories.adoc[Working with Spring Data Repositories]. Make sure you have a sound understanding of the basic concepts explained there.
66

src/main/antora/modules/ROOT/pages/jpa/configuration.adoc

-126
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
[[jpa.getting-started]]
2+
= Getting Started
3+
4+
An easy way to bootstrap setting up a working environment is to create a Spring-based project via https://start.spring.io/#!type=maven-project&dependencies=h2,data-jpa[start.spring.io] or create a Spring project in https://spring.io/tools[Spring Tools].
5+
6+
[[jpa.examples-repo]]
7+
== Examples Repository
8+
9+
The GitHub https://github.com/spring-projects/spring-data-examples[spring-data-examples repository] hosts several examples that you can download and play around with to get a feel for how the library works.
10+
11+
[[redis.hello-world]]
12+
== Hello World
13+
14+
Let's start with a simple entity and its corresponding repository:
15+
16+
[source,java]
17+
----
18+
@Entity
19+
class Person {
20+
21+
@Id @GeneratedValue(strategy = GenerationType.AUTO)
22+
private Long id;
23+
private String name;
24+
25+
// getters and setters ommited for brevity
26+
}
27+
28+
interface PersonRepository extends Repository<Person, Long> {
29+
30+
Person save(Person person);
31+
32+
Optional<Person> findById(long id);
33+
}
34+
----
35+
36+
Create the main application to run, as the following example shows:
37+
38+
[source,java]
39+
----
40+
@SpringBootApplication
41+
public class DemoApplication {
42+
43+
public static void main(String[] args) {
44+
SpringApplication.run(DemoApplication.class, args);
45+
}
46+
47+
@Bean
48+
CommandLineRunner runner(PersonRepository repository) {
49+
return args -> {
50+
51+
Person person = new Person();
52+
person.setName("John");
53+
54+
repository.save(person);
55+
Person saved = repository.findById(person.getId()).orElseThrow(NoSuchElementException::new);
56+
};
57+
}
58+
}
59+
----
60+
61+
Even in this simple example, there are a few notable things to point out:
62+
63+
* Repository instances are automatically implemented.
64+
When used as parameters of `@Bean` methods, these will be autowired without further need for annotations.
65+
* The basic repository extends `Repository`.
66+
We suggest to consider how much API surface you want to expose towards your application.
67+
More complex repository interfaces are `ListCrudRepository` or `JpaRepository`.

src/main/antora/modules/ROOT/pages/jpa/misc-context.adoc

-27
This file was deleted.

src/main/antora/modules/ROOT/pages/jpa/query-methods.adoc

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[[jpa.query-methods]]
2-
= Query Methods
2+
= JPA Query Methods
33

44
This section describes the various ways to create a query with Spring Data JPA.
55

@@ -357,9 +357,9 @@ This is a lighter variant than paging because it does not require the total resu
357357
3. <<repositories.scrolling.keyset,Keyset-baset scrolling>>.
358358
This method avoids https://use-the-index-luke.com/no-offset[the shortcomings of offset-based result retrieval by leveraging database indexes].
359359

360-
Read more on xref:repositories/query-methods-details.adoc#repositories.scrolling.guidance,which method to use best>> for your particular arrangement.
360+
Read more on <<repositories.scrolling.guidance,which method to use best>> for your particular arrangement.
361361

362-
You can use the Scroll API with query methods, xref:query-by-example.adoc[Query-by-Example], and xref:repositories/core-extensions.adoc#core.extensions.querydsl[Querydsl].
362+
You can use the Scroll API with query methods, xref:repositories/query-by-example.adoc[Query-by-Example], and xref:repositories/core-extensions.adoc#core.extensions.querydsl[Querydsl].
363363

364364
NOTE: Scrolling with String-based query methods is not yet supported.
365365
Scrolling is also not supported using stored `@Procedure` query methods.
@@ -432,7 +432,7 @@ Another use case for the `#{#entityName}` expression in a query string is if you
432432
@MappedSuperclass
433433
public abstract class AbstractMappedType {
434434
435-
String attribute
435+
String attribute;
436436
}
437437
438438
@Entity
@@ -507,7 +507,7 @@ But sometimes, your query may simply be too complicated for the techniques offer
507507
In that situation, consider:
508508

509509
* If you haven't already, simply write the query yourself using xref:jpa/query-methods.adoc#jpa.query-methods.at-query[`@Query`].
510-
* If that doesn't fit your needs, consider implementing a xref:repositories/custom-implementations.adoc#repositories.custom-implementations[custom implementation]. This lets you register a method in your repository while leaving the implementation completely up to you. This gives you the ability to:
510+
* If that doesn't fit your needs, consider implementing a xref:repositories/custom-implementations.adoc[custom implementation]. This lets you register a method in your repository while leaving the implementation completely up to you. This gives you the ability to:
511511
** Talk directly to the `EntityManager` (writing pure HQL/JPQL/EQL/native SQL or using the *Criteria API*)
512512
** Leverage Spring Framework's `JdbcTemplate` (native SQL)
513513
** Use another 3rd-party database toolkit.

0 commit comments

Comments
 (0)