From 8b10b6c9153f7609debbcf825db006b485f4cb92 Mon Sep 17 00:00:00 2001 From: Jens Schauder Date: Thu, 23 May 2019 10:36:25 +0200 Subject: [PATCH] DATAJPA-1549 - Polishing. Original pull requests: #238, #308. --- src/main/asciidoc/jpa.adoc | 6 +++--- ...oredProcedureAttributeSourceUnitTests.java | 21 +++++++++++-------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/main/asciidoc/jpa.adoc b/src/main/asciidoc/jpa.adoc index ef1842e70..65f0029a8 100644 --- a/src/main/asciidoc/jpa.adoc +++ b/src/main/asciidoc/jpa.adoc @@ -190,7 +190,7 @@ The following table describes the keywords supported for JPA and what a method c |Keyword|Sample|JPQL snippet |`And`|`findByLastnameAndFirstname`|`… where x.lastname = ?1 and x.firstname = ?2` |`Or`|`findByLastnameOrFirstname`|`… where x.lastname = ?1 or x.firstname = ?2` -|`Is,Equals`|`findByFirstname`,`findByFirstnameIs`,`findByFirstnameEquals`|`… where x.firstname = ?1` +|`Is`, `Equals`|`findByFirstname`,`findByFirstnameIs`,`findByFirstnameEquals`|`… where x.firstname = ?1` |`Between`|`findByStartDateBetween`|`… where x.startDate between ?1 and ?2` |`LessThan`|`findByAgeLessThan`|`… where x.age < ?1` |`LessThanEqual`|`findByAgeLessThanEqual`|`… where x.age \<= ?1` @@ -198,8 +198,8 @@ The following table describes the keywords supported for JPA and what a method c |`GreaterThanEqual`|`findByAgeGreaterThanEqual`|`… where x.age >= ?1` |`After`|`findByStartDateAfter`|`… where x.startDate > ?1` |`Before`|`findByStartDateBefore`|`… where x.startDate < ?1` -|`IsNull`|`findByAge(Is)Null`|`… where x.age is null` -|`IsNotNull,NotNull`|`findByAge(Is)NotNull`|`… where x.age not null` +|`IsNull`, `Null`|`findByAge(Is)Null`|`… where x.age is null` +|`IsNotNull`, `NotNull`|`findByAge(Is)NotNull`|`… where x.age not null` |`Like`|`findByFirstnameLike`|`… where x.firstname like ?1` |`NotLike`|`findByFirstnameNotLike`|`… where x.firstname not like ?1` |`StartingWith`|`findByFirstnameStartingWith`|`… where x.firstname like ?1` (parameter bound with appended `%`) diff --git a/src/test/java/org/springframework/data/jpa/repository/query/StoredProcedureAttributeSourceUnitTests.java b/src/test/java/org/springframework/data/jpa/repository/query/StoredProcedureAttributeSourceUnitTests.java index f247f7f0d..c8f6cb46b 100644 --- a/src/test/java/org/springframework/data/jpa/repository/query/StoredProcedureAttributeSourceUnitTests.java +++ b/src/test/java/org/springframework/data/jpa/repository/query/StoredProcedureAttributeSourceUnitTests.java @@ -102,12 +102,12 @@ public class StoredProcedureAttributeSourceUnitTests { assertThat(attr.getOutputParameterType(), is(typeCompatibleWith(Integer.class))); assertThat(attr.getOutputParameterName(), is(StoredProcedureAttributes.SYNTHETIC_OUTPUT_PARAMETER_NAME)); } - + @Test // DATAJPA-1297 public void shouldCreateStoredProcedureAttributesFromProcedureMethodWithExplictProcedureNameAliasAndOutputParameterName() { - StoredProcedureAttributes attr = creator - .createFrom(method("explicitPlus1inoutViaProcedureNameAliasAndOutputParameterName", Integer.class), entityMetadata); + StoredProcedureAttributes attr = creator.createFrom( + method("explicitPlus1inoutViaProcedureNameAliasAndOutputParameterName", Integer.class), entityMetadata); assertThat(attr.getProcedureName(), is("plus1inout")); assertThat(attr.getOutputParameterType(), is(typeCompatibleWith(Integer.class))); @@ -164,7 +164,8 @@ public class StoredProcedureAttributeSourceUnitTests { /** * @author Thomas Darimont */ - static interface DummyRepository { + @SuppressWarnings("unused") + interface DummyRepository { /** * Explicitly mapped to a procedure with name "plus1inout" in database. @@ -178,18 +179,19 @@ public class StoredProcedureAttributeSourceUnitTests { @Procedure(procedureName = "plus1inout") // DATAJPA-455 Integer explicitPlus1inoutViaProcedureNameAlias(Integer arg); - /** - * Explicitly mapped to a procedure with name "plus1inout" in database via alias and explicitly named ouput parameter. + /** + * Explicitly mapped to a procedure with name "plus1inout" in database via alias and explicitly named ouput + * parameter. */ @Procedure(procedureName = "plus1inout", outputParameterName = "res") // DATAJPA-1297 Integer explicitPlus1inoutViaProcedureNameAliasAndOutputParameterName(Integer arg); - + /** * Implicitly mapped to a procedure with name "plus1inout" in database via alias. */ @Procedure // DATAJPA-455 Integer plus1inout(Integer arg); - + /** * Explicitly mapped to named stored procedure "User.plus1IO" in {@link EntityManager}. */ @@ -209,9 +211,10 @@ public class StoredProcedureAttributeSourceUnitTests { Integer plus1inoutWithComposedAnnotationOverridingName(Integer arg); } + @SuppressWarnings("unused") @Procedure @Retention(RetentionPolicy.RUNTIME) - static @interface ComposedProcedureUsingAliasFor { + @interface ComposedProcedureUsingAliasFor { @AliasFor(annotation = Procedure.class, attribute = "value") String dbProcedureName() default "";