DATAJPA-564 - Removed support for SpEL expressions in derived queries.
We came to the conclusion that allowing SpEL expressions as parameters in derived queries would create incentives for users to mess with the low-level Expressions API in high level user code. Therefore we decided to remove this feature - for now.
This commit is contained in:
committed by
Oliver Gierke
parent
1879fea1f0
commit
09b6a49146
@@ -60,8 +60,6 @@ import org.springframework.data.jpa.domain.sample.SpecialUser;
|
||||
import org.springframework.data.jpa.domain.sample.User;
|
||||
import org.springframework.data.jpa.repository.SampleSecurity.SampleSecurityContextHolder;
|
||||
import org.springframework.data.jpa.repository.sample.UserRepository;
|
||||
import org.springframework.expression.Expression;
|
||||
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -1672,21 +1670,6 @@ public class UserRepositoryTests {
|
||||
assertThat(users.get(0), is(secondUser));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAJPA-564
|
||||
*/
|
||||
@Test
|
||||
public void shouldFindUserByLastnameWithSpelExpressionInDerivedQuery() {
|
||||
|
||||
flushTestUsers();
|
||||
|
||||
Expression expr = new SpelExpressionParser().parseExpression("'Gier' + 'ke'");
|
||||
List<User> users = repository.queryByLastname(expr);
|
||||
|
||||
assertThat(users, hasSize(1));
|
||||
assertThat(users.get(0), is(firstUser));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAJPA-564
|
||||
*/
|
||||
|
||||
@@ -37,7 +37,6 @@ import org.springframework.data.jpa.repository.QueryHints;
|
||||
import org.springframework.data.jpa.repository.query.Procedure;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.expression.Expression;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
@@ -473,11 +472,6 @@ public interface UserRepository extends JpaRepository<User, Integer>, JpaSpecifi
|
||||
@Query("select u from User u where u.lastname like %:#{[0]}% and u.lastname like %:lastname%")
|
||||
List<User> findByLastnameWithSpelExpression(@Param("lastname") String lastname);
|
||||
|
||||
/**
|
||||
* @see DATAJPA-564
|
||||
*/
|
||||
List<User> queryByLastname(Expression lastname);
|
||||
|
||||
/**
|
||||
* @see DATAJPA-564
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user