Skip to content

Commit eecb232

Browse files
michalfotygaschauder
authored andcommitted
DATAJPA-1807 - Small edits of the reference documentation.
Original pull request: #433.
1 parent 0901bb5 commit eecb232

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/main/asciidoc/jpa.adoc

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ Spring Data JPA offers the following strategies to detect whether an entity is n
141141

142142
1. Version-Property and Id-Property inspection (*default*):
143143
By default Spring Data JPA inspects first if there is a Version-property of non-primitive type.
144-
If there is the entity is considered new if the value is `null`.
144+
If there is, the entity is considered new if the value is `null`.
145145
Without such a Version-property Spring Data JPA inspects the identifier property of the given entity.
146146
If the identifier property is `null`, then the entity is assumed to be new.
147147
Otherwise, it is assumed to be not new.
@@ -245,10 +245,10 @@ The following table describes the keywords supported for JPA and what a method c
245245
|`NotIn`|`findByAgeNotIn(Collection<Age> ages)`|`… where x.age not in ?1`
246246
|`True`|`findByActiveTrue()`|`… where x.active = true`
247247
|`False`|`findByActiveFalse()`|`… where x.active = false`
248-
|`IgnoreCase`|`findByFirstnameIgnoreCase`|`… where UPPER(x.firstame) = UPPER(?1)`
248+
|`IgnoreCase`|`findByFirstnameIgnoreCase`|`… where UPPER(x.firstname) = UPPER(?1)`
249249
|===============
250250

251-
NOTE: `In` and `NotIn` also take any subclass of `Collection` as aparameter as well as arrays or varargs. For other syntactical versions of the same logical operator, check "`<<repository-query-keywords>>`".
251+
NOTE: `In` and `NotIn` also take any subclass of `Collection` as a parameter as well as arrays or varargs. For other syntactical versions of the same logical operator, check "`<<repository-query-keywords>>`".
252252

253253
[[jpa.query-methods.named-queries]]
254254
=== Using JPA Named Queries
@@ -302,7 +302,7 @@ public interface UserRepository extends JpaRepository<User, Long> {
302302
----
303303
====
304304

305-
Spring Data tries to resolve a call to these methods to a named query, starting with the simple name of the configured domain class, followed by the method name separated by a dot. So the preceding example would use the named queries defined in the examlpe instead of trying to create a query from the method name.
305+
Spring Data tries to resolve a call to these methods to a named query, starting with the simple name of the configured domain class, followed by the method name separated by a dot. So the preceding example would use the named queries defined earlier instead of trying to create a query from the method name.
306306

307307
[[jpa.query-methods.at-query]]
308308
=== Using `@Query`
@@ -403,13 +403,13 @@ public interface UserRepository extends JpaRepository<User, Long> {
403403
List<Object[]> findByAsArrayAndSort(String lastname, Sort sort);
404404
}
405405
406-
repo.findByAndSort("lannister", new Sort("firstname")); <1>
407-
repo.findByAndSort("stark", new Sort("LENGTH(firstname)")); <2>
406+
repo.findByAndSort("lannister", Sort.by("firstname")); <1>
407+
repo.findByAndSort("stark", Sort.by("LENGTH(firstname)")); <2>
408408
repo.findByAndSort("targaryen", JpaSort.unsafe("LENGTH(firstname)")); <3>
409-
repo.findByAsArrayAndSort("bolton", new Sort("fn_len")); <4>
409+
repo.findByAsArrayAndSort("bolton", Sort.by("fn_len")); <4>
410410
----
411411
<1> Valid `Sort` expression pointing to property in domain model.
412-
<2> Invalid `Sort` containing function call. Thows Exception.
412+
<2> Invalid `Sort` containing function call. Throws Exception.
413413
<3> Valid `Sort` containing explicitly _unsafe_ `Order`.
414414
<4> Valid `Sort` expression pointing to aliased function.
415415
====
@@ -514,7 +514,7 @@ List<User> findByFirstnameAndCurrentUserWithCustomQuery(String firstname);
514514
----
515515
====
516516

517-
For `like`-conditions one often wants to appen `%` to the beginning or the end of a String valued parameter.
517+
For `like`-conditions one often wants to append `%` to the beginning or the end of a String valued parameter.
518518
This can be done by appending or prefixing a bind parameter marker or a SpEL expression with `%`.
519519
Again the following example demonstrates this.
520520

@@ -528,7 +528,7 @@ List<User> findByLastnameWithSpelExpression(@Param("lastname") String lastname);
528528
====
529529

530530
When using `like`-conditions with values that are coming from a not secure source the values should be sanitized so they can't contain any wildcards and thereby allow attackers to select more data than they should be able to.
531-
For this purpose the the `escape(String)` method is made available in the SpEL context.
531+
For this purpose the `escape(String)` method is made available in the SpEL context.
532532
It prefixes all instances of `_` and `%` in the first argument with the single character from the second argument.
533533
In combination with the `escape` clause of the `like` expression available in JPQL and standard SQL this allows easy cleaning of bind parameters.
534534

@@ -542,7 +542,7 @@ List<User> findContainingEscaped(String namePart);
542542
----
543543
====
544544

545-
Given this method declaration in an repository interface `findContainingEscaped("Peter_")" will find `Peter_Parker` but not `Peter Parker`.
545+
Given this method declaration in a repository interface `findContainingEscaped("Peter_")` will find `Peter_Parker` but not `Peter Parker`.
546546
The escape character used can be configured by setting the `escapeCharacter` of the `@EnableJpaRepositories` annotation.
547547
Note that the method `escape(String)` available in the SpEL context will only escape the SQL and JPQL standard wildcards `_` and `%`.
548548
If the underlying database or the JPA implementation supports additional wildcards these will not get escaped.
@@ -717,7 +717,7 @@ Note that `@NamedStoredProcedureQuery` has two different names for the stored pr
717717

718718
You can reference stored procedures from a repository method in multiple ways.
719719
The stored procedure to be called can either be defined directly by using the `value` or `procedureName` attribute of the `@Procedure` annotation.
720-
This referes directly to the stored procedure in the database and ignores any configuration via `@NamedStoredProcedureQuery`.
720+
This refers directly to the stored procedure in the database and ignores any configuration via `@NamedStoredProcedureQuery`.
721721

722722
Alternatively you may specify the `@NamedStoredProcedureQuery.name` attribute as the `@Procedure.name` attribute.
723723
If neither `value`, `procedureName` nor `name` is configured, the name of the repository method is used as the `name` attribute.
@@ -967,7 +967,7 @@ This method declaration causes the query being triggered to be equipped with a `
967967
interface UserRepository extends Repository<User, Long> {
968968
969969
// Redeclaration of a CRUD method
970-
@Lock(LockModeType.READ);
970+
@Lock(LockModeType.READ)
971971
List<User> findAll();
972972
}
973973
----
@@ -1129,7 +1129,7 @@ class EntityManagerFactoryProducer {
11291129
@Produces
11301130
@ApplicationScoped
11311131
public EntityManagerFactory createEntityManagerFactory() {
1132-
return Persistence.createEntityManagerFactory("my-presistence-unit");
1132+
return Persistence.createEntityManagerFactory("my-persistence-unit");
11331133
}
11341134
11351135
public void close(@Disposes EntityManagerFactory entityManagerFactory) {

0 commit comments

Comments
 (0)