Skip to content

Commit 99a8b01

Browse files
committed
Harmonize content.
Refactor content to a natural flow, remove duplications, extract partials. See #1597
1 parent 4202b09 commit 99a8b01

30 files changed

+774
-666
lines changed

README.adoc

+110-24
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
image:https://spring.io/badges/spring-data-jdbc/ga.svg["Spring Data JDBC", link="https://spring.io/projects/spring-data-jdbc#learn"]
2-
image:https://spring.io/badges/spring-data-jdbc/snapshot.svg["Spring Data JDBC", link="https://spring.io/projects/spring-data-jdbc#learn"]
3-
4-
= Spring Data JDBC image:https://jenkins.spring.io/buildStatus/icon?job=spring-data-jdbc%2Fmain&subject=Build[link=https://jenkins.spring.io/view/SpringData/job/spring-data-jdbc/] https://gitter.im/spring-projects/spring-data[image:https://badges.gitter.im/spring-projects/spring-data.svg[Gitter]]
1+
= Spring Data Relational image:https://jenkins.spring.io/buildStatus/icon?job=spring-data-jdbc%2Fmain&subject=Build[link=https://jenkins.spring.io/view/SpringData/job/spring-data-jdbc/] https://gitter.im/spring-projects/spring-data[image:https://badges.gitter.im/spring-projects/spring-data.svg[Gitter]]
52

63
The primary goal of the https://projects.spring.io/spring-data[Spring Data] project is to make it easier to build Spring-powered applications that use new data access technologies such as non-relational databases, map-reduce frameworks, and cloud based data services.
74

8-
Spring Data JDBC, part of the larger Spring Data family, makes it easy to implement JDBC based repositories. This module deals with enhanced support for JDBC based data access layers. It makes it easier to build Spring powered applications that use data access technologies.
5+
Spring Data Relational, part of the larger Spring Data family, makes it easy to implement repositories for SQL databases.
6+
This module deals with enhanced support for JDBC and R2DBC based data access layers.
7+
It makes it easier to build Spring powered applications that use data access technologies.
98

109
It aims at being conceptually easy.
1110
In order to achieve this it does NOT offer caching, lazy loading, write behind or many other features of JPA.
12-
This makes Spring Data JDBC a simple, limited, opinionated ORM.
11+
This makes Spring Data JDBC and Spring Data R2DBC a simple, limited, opinionated ORM.
1312

1413
== Features
1514

@@ -18,20 +17,20 @@ This makes Spring Data JDBC a simple, limited, opinionated ORM.
1817
* Support for transparent auditing (created, last changed)
1918
* Events for persistence events
2019
* Possibility to integrate custom repository code
21-
* JavaConfig based repository configuration by introducing `EnableJdbcRepository`
22-
* Integration with MyBatis
20+
* JavaConfig based repository configuration through `@EnableJdbcRepositories` respective `@EnableR2dbcRepositories`
21+
* JDBC-only: Integration with MyBatis
2322

2423
== Code of Conduct
2524

2625
This project is governed by the https://github.com/spring-projects/.github/blob/e3cc2ff230d8f1dca06535aa6b5a4a23815861d4/CODE_OF_CONDUCT.md[Spring Code of Conduct]. By participating, you are expected to uphold this code of conduct. Please report unacceptable behavior to [email protected].
2726

28-
== Getting Started
27+
== Getting Started with JDBC
2928

30-
Here is a quick teaser of an application using Spring Data Repositories in Java:
29+
Here is a quick teaser of an application using Spring Data JDBC Repositories in Java:
3130

3231
[source,java]
3332
----
34-
public interface PersonRepository extends CrudRepository<Person, Long> {
33+
interface PersonRepository extends CrudRepository<Person, Long> {
3534
3635
@Query("SELECT * FROM person WHERE lastname = :lastname")
3736
List<Person> findByLastname(String lastname);
@@ -41,7 +40,7 @@ public interface PersonRepository extends CrudRepository<Person, Long> {
4140
}
4241
4342
@Service
44-
public class MyService {
43+
class MyService {
4544
4645
private final PersonRepository repository;
4746
@@ -88,7 +87,7 @@ Add the Maven dependency:
8887
<dependency>
8988
<groupId>org.springframework.data</groupId>
9089
<artifactId>spring-data-jdbc</artifactId>
91-
<version>${version}.RELEASE</version>
90+
<version>${version}</version>
9291
</dependency>
9392
----
9493

@@ -99,7 +98,89 @@ If you'd rather like the latest snapshots of the upcoming major version, use our
9998
<dependency>
10099
<groupId>org.springframework.data</groupId>
101100
<artifactId>spring-data-jdbc</artifactId>
102-
<version>${version}.BUILD-SNAPSHOT</version>
101+
<version>${version}-SNAPSHOT</version>
102+
</dependency>
103+
104+
<repository>
105+
<id>spring-libs-snapshot</id>
106+
<name>Spring Snapshot Repository</name>
107+
<url>https://repo.spring.io/snapshot</url>
108+
</repository>
109+
----
110+
111+
== Getting Started with R2DBC
112+
113+
Here is a quick teaser of an application using Spring Data R2DBC Repositories in Java:
114+
115+
[source,java]
116+
----
117+
interface PersonRepository extends ReactiveCrudRepository<Person, Long> {
118+
119+
@Query("SELECT * FROM person WHERE lastname = :lastname")
120+
Flux<Person> findByLastname(String lastname);
121+
122+
@Query("SELECT * FROM person WHERE firstname LIKE :firstname")
123+
Flux<Person> findByFirstnameLike(String firstname);
124+
}
125+
126+
@Service
127+
class MyService {
128+
129+
private final PersonRepository repository;
130+
131+
public MyService(PersonRepository repository) {
132+
this.repository = repository;
133+
}
134+
135+
public Flux<Person> doWork() {
136+
137+
Person person = new Person();
138+
person.setFirstname("Jens");
139+
person.setLastname("Schauder");
140+
repository.save(person);
141+
142+
Mono<Void> deleteAll = repository.deleteAll();
143+
144+
Flux<Person> lastNameResults = repository.findByLastname("Schauder");
145+
Flux<Person> firstNameResults = repository.findByFirstnameLike("Je%");
146+
147+
return deleteAll.thenMany(lastNameResults.concatWith(firstNameResults));
148+
}
149+
}
150+
151+
@Configuration
152+
@EnableR2dbcRepositories
153+
class ApplicationConfig extends AbstractR2dbcConfiguration {
154+
155+
@Bean
156+
public ConnectionFactory connectionFactory() {
157+
return ConnectionFactories.get("r2dbc:<driver>://<host>:<port>/<database>");
158+
}
159+
160+
}
161+
----
162+
163+
=== Maven configuration
164+
165+
Add the Maven dependency:
166+
167+
[source,xml]
168+
----
169+
<dependency>
170+
<groupId>org.springframework.data</groupId>
171+
<artifactId>spring-data-r2dbc</artifactId>
172+
<version>${version}</version>
173+
</dependency>
174+
----
175+
176+
If you'd rather like the latest snapshots of the upcoming major version, use our Maven snapshot repository and declare the appropriate dependency version.
177+
178+
[source,xml]
179+
----
180+
<dependency>
181+
<groupId>org.springframework.data</groupId>
182+
<artifactId>spring-data-r2dbc</artifactId>
183+
<version>${version}-SNAPSHOT</version>
103184
</dependency>
104185
105186
<repository>
@@ -111,32 +192,36 @@ If you'd rather like the latest snapshots of the upcoming major version, use our
111192

112193
== Getting Help
113194

114-
Having trouble with Spring Data? We’d love to help!
195+
Having trouble with Spring Data?
196+
We’d love to help!
115197

116198
* If you are new to Spring Data JDBC read the following two articles https://spring.io/blog/2018/09/17/introducing-spring-data-jdbc["Introducing Spring Data JDBC"] and https://spring.io/blog/2018/09/24/spring-data-jdbc-references-and-aggregates["Spring Data JDBC, References, and Aggregates"].
117199
* Check the
118200
https://docs.spring.io/spring-data/jdbc/docs/current/reference/html/[reference documentation], and https://docs.spring.io/spring-data/jdbc/docs/current/api/[Javadocs].
119201
* 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.
120202
If you are just starting out with Spring, try one of the https://spring.io/guides[guides].
121203
* If you are upgrading, check out the https://docs.spring.io/spring-data/jdbc/docs/current/changelog.txt[changelog] for "`new and noteworthy`" features.
122-
* Ask a question - we monitor https://stackoverflow.com[stackoverflow.com] for questions tagged with https://stackoverflow.com/tags/spring-data[`spring-data-jdbc`].
204+
* Ask a question - we monitor https://stackoverflow.com[stackoverflow.com] for questions tagged with https://stackoverflow.com/tags/spring-data[`spring-data`].
123205
You can also chat with the community on https://gitter.im/spring-projects/spring-data[Gitter].
124206

125207
== Reporting Issues
126208

127-
Spring Data uses GitHub as issue tracking system to record bugs and feature requests. If you want to raise an issue, please follow the recommendations below:
209+
Spring Data uses GitHub as issue tracking system to record bugs and feature requests.If you want to raise an issue, please follow the recommendations below:
128210

129-
* Before you log a bug, please search the
130-
Spring Data JDBCs https://github.com/spring-projects/spring-data-jdbc/issues[issue tracker] to see if someone has already reported the problem.
131-
* If the issue doesn’t already exist, https://github.com/spring-projects/spring-data-jdbc/issues/new[create a new issue].
132-
* Please provide as much information as possible with the issue report, we like to know the version of Spring Data that you are using and JVM version. Please include full stack traces when applicable.
211+
* Before you log a bug, please search the Spring Data JDBCs https://github.com/spring-projects/spring-data-relational/issues[issue tracker] to see if someone has already reported the problem.
212+
* If the issue doesn’t already exist, https://github.com/spring-projects/spring-data-relational/issues/new[create a new issue].
213+
* Please provide as much information as possible with the issue report, we like to know the version of Spring Data that you are using and JVM version.
214+
Please include full stack traces when applicable.
133215
* If you need to paste code, or include a stack trace use triple backticks before and after your text.
134-
* If possible try to create a test-case or project that replicates the issue. Attach a link to your code or a compressed file containing your code. Use an in-memory database when possible. If you need a different database include the setup using https://github.com/testcontainers[Testcontainers] in your test.
216+
* If possible try to create a test-case or project that replicates the issue.
217+
Attach a link to your code or a compressed file containing your code.
218+
Use an in-memory database when possible.
219+
If you need a different database include the setup using https://github.com/testcontainers[Testcontainers] in your test.
135220

136221
== Building from Source
137222

138223
You don’t need to build from source to use Spring Data (binaries in https://repo.spring.io[repo.spring.io]), but if you want to try out the latest and greatest, Spring Data can be easily built with the https://github.com/takari/maven-wrapper[maven wrapper].
139-
You also need JDK 1.8.
224+
You also need JDK 17.
140225

141226
[source,bash]
142227
----
@@ -195,11 +280,12 @@ There are a number of modules in this project, here is a quick overview:
195280

196281
* Spring Data Relational: Common infrastructure abstracting general aspects of relational database access.
197282
* link:spring-data-jdbc[Spring Data JDBC]: Repository support for JDBC-based datasources.
283+
* link:spring-data-r2dbc[Spring Data R2DBC]: Repository support for R2DBC-based datasources.
198284

199285
== Examples
200286

201287
* https://github.com/spring-projects/spring-data-examples/[Spring Data Examples] contains example projects that explain specific features in more detail.
202288

203289
== License
204290

205-
Spring Data JDBC is Open Source software released under the https://www.apache.org/licenses/LICENSE-2.0.html[Apache 2.0 license].
291+
Spring Data Relational is Open Source software released under the https://www.apache.org/licenses/LICENSE-2.0.html[Apache 2.0 license].

spring-data-jdbc-distribution/pom.xml

+5
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@
4444

4545
</plugin>
4646

47+
<plugin>
48+
<groupId>org.apache.maven.plugins</groupId>
49+
<artifactId>maven-assembly-plugin</artifactId>
50+
</plugin>
51+
4752
<plugin>
4853
<groupId>io.spring.maven.antora</groupId>
4954
<artifactId>antora-maven-plugin</artifactId>

spring-data-jdbc/README.adoc

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
image:https://spring.io/badges/spring-data-jdbc/ga.svg["Spring Data JDBC", link="https://spring.io/projects/spring-data-jdbc#learn"]
2-
image:https://spring.io/badges/spring-data-jdbc/snapshot.svg["Spring Data JDBC", link="https://spring.io/projects/spring-data-jdbc#learn"]
3-
41
= Spring Data JDBC
52

63
The primary goal of the https://projects.spring.io/spring-data[Spring Data] project is to make it easier to build Spring-powered applications that use data access technologies. *Spring Data JDBC* offers the popular Repository abstraction based on JDBC.

spring-data-r2dbc/src/test/java/org/springframework/data/r2dbc/documentation/QueryByExampleTests.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ void queryByExampleSimple() {
5555

5656
Example<Employee> example = Example.of(employee); // <2>
5757

58-
Flux<Employee> employees = repository.findAll(example); // <3>
58+
repository.findAll(example); // <3>
5959

60-
// do whatever with the flux
60+
// do whatever with the result
6161
// end::example[]
6262

63-
employees //
63+
repository.findAll(example) //
6464
.as(StepVerifier::create) //
6565
.expectNext(new Employee(1, "Frodo", "ring bearer")) //
6666
.verifyComplete();
@@ -87,12 +87,12 @@ void queryByExampleCustomMatcher() {
8787
.withIgnorePaths("role"); // <4>
8888
Example<Employee> example = Example.of(employee, matcher); // <5>
8989

90-
Flux<Employee> employees = repository.findAll(example);
90+
repository.findAll(example);
9191

92-
// do whatever with the flux
92+
// do whatever with the result
9393
// end::example-2[]
9494

95-
employees //
95+
repository.findAll(example) //
9696
.as(StepVerifier::create) //
9797
.expectNext(new Employee(1, "Frodo Baggins", "ring bearer")) //
9898
.expectNext(new Employee(1, "Bilbo Baggins", "burglar")) //

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

+11-14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
* xref:index.adoc[Overview]
22
** xref:commons/upgrade.adoc[]
3+
34
* xref:repositories/introduction.adoc[]
45
** xref:repositories/core-concepts.adoc[]
56
** xref:repositories/definition.adoc[]
@@ -9,47 +10,43 @@
910
** xref:object-mapping.adoc[]
1011
** xref:commons/custom-conversions.adoc[]
1112
** xref:repositories/custom-implementations.adoc[]
13+
** xref:repositories/core-extensions.adoc[]
14+
** xref:query-by-example.adoc[]
1215
** xref:repositories/core-domain-events.adoc[]
1316
** xref:commons/entity-callbacks.adoc[]
14-
** xref:repositories/core-extensions.adoc[]
1517
** xref:repositories/null-handling.adoc[]
1618
** xref:repositories/query-keywords-reference.adoc[]
1719
** xref:repositories/query-return-types-reference.adoc[]
20+
1821
* xref:jdbc.adoc[]
1922
** xref:jdbc/why.adoc[]
2023
** xref:jdbc/domain-driven-design.adoc[]
2124
** xref:jdbc/getting-started.adoc[]
22-
** xref:jdbc/examples-repo.adoc[]
23-
** xref:jdbc/configuration.adoc[]
2425
** xref:jdbc/entity-persistence.adoc[]
25-
** xref:jdbc/loading-aggregates.adoc[]
26+
** xref:jdbc/mapping.adoc[]
2627
** xref:jdbc/query-methods.adoc[]
2728
** xref:jdbc/mybatis.adoc[]
2829
** xref:jdbc/events.adoc[]
29-
** xref:jdbc/logging.adoc[]
30-
** xref:jdbc/transactions.adoc[]
3130
** xref:jdbc/auditing.adoc[]
32-
** xref:jdbc/mapping.adoc[]
33-
** xref:jdbc/custom-conversions.adoc[]
34-
** xref:jdbc/locking.adoc[]
35-
** xref:query-by-example.adoc[]
31+
** xref:jdbc/transactions.adoc[]
3632
** xref:jdbc/schema-support.adoc[]
33+
3734
* xref:r2dbc.adoc[]
3835
** xref:r2dbc/getting-started.adoc[]
39-
** xref:r2dbc/core.adoc[]
40-
** xref:r2dbc/template.adoc[]
36+
** xref:r2dbc/entity-persistence.adoc[]
37+
** xref:r2dbc/mapping.adoc[]
4138
** xref:r2dbc/repositories.adoc[]
4239
** xref:r2dbc/query-methods.adoc[]
4340
** xref:r2dbc/entity-callbacks.adoc[]
4441
** xref:r2dbc/auditing.adoc[]
45-
** xref:r2dbc/mapping.adoc[]
46-
** xref:r2dbc/query-by-example.adoc[]
4742
** xref:r2dbc/kotlin.adoc[]
4843
** xref:r2dbc/migration-guide.adoc[]
44+
4945
* xref:kotlin.adoc[]
5046
** xref:kotlin/requirements.adoc[]
5147
** xref:kotlin/null-safety.adoc[]
5248
** xref:kotlin/object-mapping.adoc[]
5349
** xref:kotlin/extensions.adoc[]
5450
** xref:kotlin/coroutines.adoc[]
51+
5552
* https://github.com/spring-projects/spring-data-commons/wiki[Wiki]

src/main/antora/modules/ROOT/pages/jdbc/auditing.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[[jdbc.auditing]]
2-
= JDBC Auditing
2+
= Auditing
33
:page-section-summary-toc: 1
44

55
In order to activate auditing, add `@EnableJdbcAuditing` to your configuration, as the following example shows:

0 commit comments

Comments
 (0)