@@ -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 `%`)
|
||||
|
||||
@@ -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 "";
|
||||
|
||||
Reference in New Issue
Block a user