Name for parameter binding must not be null or empty! On JDKs < 8, you need to use @Param for named
2017-11-23 16:04
4403 查看
SpringBoor加 jpa,工作当中出现了如下的错误,
贴上代码:
现在是这样不能写了么?
于是把“:” 改成“?1”,问题解决
2017-11-23 15:55:37.600 ERROR 11188 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessApiUsageException: Name for parameter binding must not be null or empty! On JDKs < 8, you need to use @Param for named parameters, on JDK 8 or better, be sure to compile with -parameters.; nested exception is java.lang.IllegalArgumentException: Name for parameter binding must not be null or empty! On JDKs < 8, you need to use @Param for named parameters, on JDK 8 or better, be sure to compile with -parameters.] with root cause java.lang.IllegalArgumentException: Name for parameter binding must not be null or empty! On JDKs < 8, you need to use @Param for named parameters, on JDK 8 or better, be sure to compile with -parameters. at org.springframework.util.Assert.hasText(Assert.java:181) at org.springframework.data.jpa.repository.query.StringQuery.getBindingFor(StringQuery.java:105) at org.springframework.data.jpa.repository.query.StringQueryParameterBinder.getBindingFor(StringQueryParameterBinder.java:75) at org.springframework.data.jpa.repository.query.StringQueryParameterBinder.bind(StringQueryParameterBinder.java:60) at org.springframework.data.jpa.repository.query.ParameterBinder.bind(ParameterBinder.java:101) at
贴上代码:
@Query("select u from AppUser u where u.mobile = :mobile and u.pass = :pass") AppUser withMobleAndPassQuery(@Param("mobile")String mobile,@Param("pass")String pass);
现在是这样不能写了么?
于是把“:” 改成“?1”,问题解决
@Query("select u from AppUser u where u.mobile = ?1 and u.pass = ?2") AppUser withMobleAndPassQuery(@Param("mobile")String mobile,@Param("pass")String pass);
相关文章推荐
- Argument for @NotNull parameter 'name' of com/android/tools/idea/welcome/Platform.<init> must not be
- Argument for @NotNull parameter 'name' of com/android/tools/idea/welcome/Platform.<init> must not be
- 使用mysql-connector-java.jar连接MySql时出现:Error while retrieving metadata for procedure columns: java.sql.SQLException: Parameter/Column name pattern can not be NULL or empty.
- org.springframework.dao.InvalidDataAccessApiUsageException: Name must not be null or empty!;
- tomcat 7 WARNING: A context path must either be an empty string or start with a '/' and do not end with a '/'. The path [/] does not meet these criteria and has been changed to []
- could not be set to a 'string' value. You must set this property to a non-null value of type
- java.sql.SQLException: The SQL statement must not be null or empty.这个错误
- The controller for path '/favicon.ico' could not be found or it does not implement the IController interface./r/nParameter name:
- Column name pattern can not be NULL or empty
- You need to run build with JDK or have tools.jar on the classpath.
- Visual Studio使用"go to definition"出现"A definition for the symbol '<symbolName>' could not be located
- [未解决] The username entered must be the same as the database accesss account for the server farm you wish to join.
- 闪屏页面开发遇到的问题you need to use a theme.appcompat theme (or descendant)
- VS 安装助手,弹出“The security key for this program currently stored on your system does not appear to be ”
- You need to use a Theme.AppCompat theme (or descendant) with this activity
- HttpClient:Target host must not be null, or set in parameters
- Android:真机调试遇到的问题(You need to use a Theme.AppCompat theme (or descendant) with this activity)
- 解决错误:You need to use a Theme.AppCompat theme (or descendant) with this activity.
- You must use the Role Management Tool to install or configure Microsoft .NET Framework 3.5
- 解决ORA-02069: global_names parameter must be set to TRUE for this operation 问题