diff --git a/jpa/example/src/main/java/example/springdata/jpa/custom/UserRepository.java b/jpa/example/src/main/java/example/springdata/jpa/custom/UserRepository.java index 7f39e6aa..163fe2bd 100644 --- a/jpa/example/src/main/java/example/springdata/jpa/custom/UserRepository.java +++ b/jpa/example/src/main/java/example/springdata/jpa/custom/UserRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2014 the original author or authors. + * Copyright 2013-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -55,6 +55,6 @@ public interface UserRepository extends CrudRepository, UserReposito * @param firstname * @return */ - @Query("select u from User u where u.firstname = ?1") + @Query("select u from User u where u.firstname = :firstname") List findByFirstname(String firstname); } diff --git a/jpa/example/src/main/java/example/springdata/jpa/simple/SimpleUserRepository.java b/jpa/example/src/main/java/example/springdata/jpa/simple/SimpleUserRepository.java index fb8c49a8..0cddebb3 100644 --- a/jpa/example/src/main/java/example/springdata/jpa/simple/SimpleUserRepository.java +++ b/jpa/example/src/main/java/example/springdata/jpa/simple/SimpleUserRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2014 the original author or authors. + * Copyright 2013-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,6 @@ import org.springframework.data.domain.Slice; import org.springframework.data.domain.Sort; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.CrudRepository; -import org.springframework.data.repository.query.Param; import com.google.common.base.Optional; @@ -63,19 +62,18 @@ public interface SimpleUserRepository extends CrudRepository { * @param firstname * @return */ - @Query("select u from User u where u.firstname = ?") + @Query("select u from User u where u.firstname = :firstname") List findByFirstname(String firstname); /** - * Returns all users with the given name as first- or lastname. Makes use of the {@link Param} annotation to use named - * parameters in queries. This makes the query to method relation much more refactoring safe as the order of the - * method parameters is completely irrelevant. + * Returns all users with the given name as first- or lastname. This makes the query to method relation much more + * refactoring safe as the order of the method parameters is completely irrelevant. * * @param name * @return */ @Query("select u from User u where u.firstname = :name or u.lastname = :name") - List findByFirstnameOrLastname(@Param("name") String name); + List findByFirstnameOrLastname(String name); /** * Returns the total number of entries deleted as their lastnames match the given one. @@ -126,5 +124,5 @@ public interface SimpleUserRepository extends CrudRepository { * @return */ @Query("select u from User u where u.firstname = :#{#user.firstname} or u.lastname = :#{#user.lastname}") - Iterable findByFirstnameOrLastname(@Param("user") User user); + Iterable findByFirstnameOrLastname(User user); } diff --git a/jpa/jpa21/pom.xml b/jpa/jpa21/pom.xml index d4052f54..cdc09db8 100644 --- a/jpa/jpa21/pom.xml +++ b/jpa/jpa21/pom.xml @@ -10,5 +10,9 @@ spring-data-jpa-jpa21 Spring Data JPA - JPA 2.1 specific features + + + Fowler-BUILD-SNAPSHOT + \ No newline at end of file diff --git a/jpa/jpa21/src/main/java/example/springdata/jpa/storedprocedures/UserRepository.java b/jpa/jpa21/src/main/java/example/springdata/jpa/storedprocedures/UserRepository.java index 3f721e7a..e6789a5f 100644 --- a/jpa/jpa21/src/main/java/example/springdata/jpa/storedprocedures/UserRepository.java +++ b/jpa/jpa21/src/main/java/example/springdata/jpa/storedprocedures/UserRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2013 the original author or authors. + * Copyright 2013-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,6 @@ import javax.persistence.EntityManager; import org.springframework.data.jpa.repository.query.Procedure; import org.springframework.data.repository.CrudRepository; -import org.springframework.data.repository.query.Param; /** * Simple repository interface for {@link User} instances. The interface is used to declare so called query methods, @@ -36,7 +35,7 @@ public interface UserRepository extends CrudRepository { * @see User */ @Procedure(name = "User.plus1") - Integer plus1BackedByOtherNamedStoredProcedure(@Param("arg") Integer arg); + Integer plus1BackedByOtherNamedStoredProcedure(Integer arg); /** * Directly map the method to the stored procedure in the database (to avoid the annotation madness on your domain diff --git a/pom.xml b/pom.xml index df001aae..60e33d21 100644 --- a/pom.xml +++ b/pom.xml @@ -72,6 +72,22 @@ + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + ${java.version} + ${java.version} + -parameters + + + + + + spring-libs-snapshot diff --git a/rest/starbucks/src/main/java/example/stores/StoreApp.java b/rest/starbucks/src/main/java/example/stores/StoreApp.java index 9bb387a7..b23ce7ba 100644 --- a/rest/starbucks/src/main/java/example/stores/StoreApp.java +++ b/rest/starbucks/src/main/java/example/stores/StoreApp.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 the original author or authors. + * Copyright 2014-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,16 +16,14 @@ package example.stores; import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.context.annotation.ComponentScan; +import org.springframework.boot.autoconfigure.SpringBootApplication; /** * Spring configuration class main application bootstrap point. * * @author Oliver Gierke */ -@EnableAutoConfiguration -@ComponentScan +@SpringBootApplication public class StoreApp { public static void main(String[] args) { diff --git a/rest/starbucks/src/main/java/example/stores/StoreRepository.java b/rest/starbucks/src/main/java/example/stores/StoreRepository.java index 1b468d37..338b650a 100644 --- a/rest/starbucks/src/main/java/example/stores/StoreRepository.java +++ b/rest/starbucks/src/main/java/example/stores/StoreRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 the original author or authors. + * Copyright 2014-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,6 @@ import org.springframework.data.domain.Pageable; import org.springframework.data.geo.Distance; import org.springframework.data.geo.Point; import org.springframework.data.repository.PagingAndSortingRepository; -import org.springframework.data.repository.query.Param; import org.springframework.data.rest.core.annotation.RestResource; /** @@ -32,6 +31,5 @@ import org.springframework.data.rest.core.annotation.RestResource; public interface StoreRepository extends PagingAndSortingRepository { @RestResource(rel = "by-location") - Page findByAddressLocationNear(// - @Param("location") Point location, @Param("distance") Distance distance, Pageable pageable); + Page findByAddressLocationNear(Point location, Distance distance, Pageable pageable); }