Skip to content

Refine ref docs. #3006

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa-parent</artifactId>
<version>3.2.0-SNAPSHOT</version>
<version>3.2.0-gh-3005-SNAPSHOT</version>
<packaging>pom</packaging>

<name>Spring Data JPA Parent</name>
Expand Down
4 changes: 2 additions & 2 deletions spring-data-envers/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

<groupId>org.springframework.data</groupId>
<artifactId>spring-data-envers</artifactId>
<version>3.2.0-SNAPSHOT</version>
<version>3.2.0-gh-3005-SNAPSHOT</version>

<parent>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa-parent</artifactId>
<version>3.2.0-SNAPSHOT</version>
<version>3.2.0-gh-3005-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion spring-data-jpa-distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa-parent</artifactId>
<version>3.2.0-SNAPSHOT</version>
<version>3.2.0-gh-3005-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
4 changes: 2 additions & 2 deletions spring-data-jpa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>3.2.0-SNAPSHOT</version>
<version>3.2.0-gh-3005-SNAPSHOT</version>

<name>Spring Data JPA</name>
<description>Spring Data module for JPA repositories.</description>
Expand All @@ -15,7 +15,7 @@
<parent>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa-parent</artifactId>
<version>3.2.0-SNAPSHOT</version>
<version>3.2.0-gh-3005-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
16 changes: 16 additions & 0 deletions src/main/asciidoc/jpa.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,22 @@ The escape character used can be configured by setting the `escapeCharacter` of
Note that the method `escape(String)` available in the SpEL context will only escape the SQL and JPQL standard wildcards `_` and `%`.
If the underlying database or the JPA implementation supports additional wildcards these will not get escaped.

[[jpa.query.other-methods]]
=== Other Methods

Spring Data JPA offers many ways to build queries.
But sometimes, your query may simply be too complicated for the techniques offered.
In that situation, consider:

* If you haven't already, simply write the query yourself using <<jpa.query-methods.at-query,`@Query`>>.
* Sometimes, you can put your query inside the database use Spring Data JPA's <<jpa.stored-procedures,`@StoredProcedure` annotation>>, or if it's a database function use the <<jpa.query-methods.at-query,`@Query` annotation>> and invoke it with a `CALL`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's mention stored procedures after recommending JdbcTemplate because it creates a tighter coupling with the database requirements.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

* If neither of these fit your needs, it may be time to implement a <<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:
** Talk directly to the `EntityManager` (writing pure HQL/JPQL/EQL/native SQL or using the *Criteria API*)
** Leverage Spring Framework's `JdbcTemplate` (native SQL)
** Use another 3rd-party database toolkit.

These tactics may be most effective when you need maximum control of your query, while still letting Spring Data JPA provide resource management.

[[jpa.modifying-queries]]
=== Modifying Queries

Expand Down