我有以下JPQL请求;
@Query(value = "select req_t " +
"from TransactionRelation tr " +
"inner join tr.requestTransaction req_t " +
"inner join req_t.transactionStateHistory req_t_h " +
"inner join tr.responseTransaction resp_t " +
"inner join resp_t.transactionStateHistory resp_t_h " +
"where req_t.id >?1 " +
"and req_t.receiver.id=?2 and req_t.requestType in ?3" +
"and NOT EXISTS (select t from resp_t_h t where t.transactionState = 'REPLIED' )" +
"and EXISTS (select tt from req_t_h tt where tt.transactionState = 'WAITING_PROVIDER' )"
)
List<Transaction> queryTrabsactions(Long transactionId, Long providerId, Collection<RequestType> requestTypes);
但它打印以下错误:
Caused by: java.lang.IllegalArgumentException: Validation failed for query for method public abstract java.util.List com.finvale.repositories.TransactionRepository.queryTransactions(java.lang.Long,java.lang.Long,java.util.Collection)!
at org.springframework.data.jpa.repository.query.SimpleJpaQuery.validateQuery(SimpleJpaQuery.java:92) ~[spring-data-jpa-1.11.1.RELEASE.jar:na]
at org.springframework.data.jpa.repository.query.SimpleJpaQuery.<init>(SimpleJpaQuery.java:62) ~[spring-data-jpa-1.11.1.RELEASE.jar:na]
at org.springframework.data.jpa.repository.query.JpaQueryFactory.fromMethodWithQueryString(JpaQueryFactory.java:72) ~[spring-data-jpa-1.11.1.RELEASE.jar:na]
at org.springframework.data.jpa.repository.query.JpaQueryFactory.fromQueryAnnotation(JpaQueryFactory.java:53) ~[spring-data-jpa-1.11.1.RELEASE.jar:na]
at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$DeclaredQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:144) ~[spring-data-jpa-1.11.1.RELEASE.jar:na]
at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:212) ~[spring-data-jpa-1.11.1.RELEASE.jar:na]
at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:77) ~[spring-data-jpa-1.11.1.RELEASE.jar:na]
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.<init>(RepositoryFactorySupport.java:436) ~[spring-data-commons-1.13.1.RELEASE.jar:na]
at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:221) ~[spring-data-commons-1.13.1.RELEASE.jar:na]
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.initAndReturn(RepositoryFactoryBeanSupport.java:277) ~[spring-data-commons-1.13.1.RELEASE.jar:na]
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:263) ~[spring-data-commons-1.13.1.RELEASE.jar:na]
at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:101) ~[spring-data-jpa-1.11.1.RELEASE.jar:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
... 47 common frames omitted
Caused by: java.lang.IllegalArgumentException: org.hibernate.QueryException: JPA-style positional param was not an integral ordinal
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:131) ~[hibernate-core-5.2.10.Final.jar:5.2.10.Final]
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:155) ~[hibernate-core-5.2.10.Final.jar:5.2.10.Final]
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:162) ~[hibernate-core-5.2.10.Final.jar:5.2.10.Final]
at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:663) ~[hibernate-core-5.2.10.Final.jar:5.2.10.Final]
at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:23) ~[hibernate-core-5.2.10.Final.jar:5.2.10.Final]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_111]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_111]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_111]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_111]
at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:347) ~[spring-orm-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at com.sun.proxy.$Proxy112.createQuery(Unknown Source) ~[na:na]
at org.springframework.data.jpa.repository.query.SimpleJpaQuery.validateQuery(SimpleJpaQuery.java:86) ~[spring-data-jpa-1.11.1.RELEASE.jar:na]
... 60 common frames omitted
Caused by: org.hibernate.QueryException: JPA-style positional param was not an integral ordinal
at org.hibernate.engine.query.spi.ParameterParser.parse(ParameterParser.java:192) ~[hibernate-core-5.2.10.Final.jar:5.2.10.Final]
at org.hibernate.engine.query.spi.ParamLocationRecognizer.parseLocations(ParamLocationRecognizer.java:59) ~[hibernate-core-5.2.10.Final.jar:5.2.10.Final]
at org.hibernate.engine.query.spi.HQLQueryPlan.buildParameterMetadata(HQLQueryPlan.java:381) ~[hibernate-core-5.2.10.Final.jar:5.2.10.Final]
at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:134) ~[hibernate-core-5.2.10.Final.jar:5.2.10.Final]
at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:77) ~[hibernate-core-5.2.10.Final.jar:5.2.10.Final]
at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:153) ~[hibernate-core-5.2.10.Final.jar:5.2.10.Final]
at org.hibernate.internal.AbstractSharedSessionContract.getQueryPlan(AbstractSharedSessionContract.java:546) ~[hibernate-core-5.2.10.Final.jar:5.2.10.Final]
at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:655) ~[hibernate-core-5.2.10.Final.jar:5.2.10.Final]
... 68 common frames omitted
我的问题的原因是什么?
对我来说,我的参数和运算符之间没有空格。发生这种情况是因为我对两行代码进行了查询
这发生在我身上,我有一个“;”char在我的查询结束时,从我的数据库查询工具粘贴副本:
@Query(value = " DELETE FROM reunion WHERE id = ?1; ", nativeQuery = true)
行之间没有空格
"and req_t.receiver.id=?2 and req_t.requestType in ?3" +
"and NOT EXISTS
还检查了吗?3参数不是空列表
问题内容: 我有以下JPQL请求; 但它显示以下错误: 我的问题是什么原因? 问题答案: 行之间没有空格 还要检查?3参数是否为空列表
我得到了“QueryException:JPA风格的位置参数不是整数序数”,我试图通过其他求解方法(如org)来求解。冬眠QueryException:JPA风格的位置参数不是整数序数,但仍然不起作用。 我尝试硬编码更改表单?1到数据库中已经有的一些数据,它可以工作,但更改为?1后它再次给出错误。 ---硬代码之前(有错误)--在存储库中-- --正在使用中-- --在控制器中-- -在硬代码之后
我想执行我的选择查询, @查询(value=“select*from data o,其中o.id=:id”,nativeQuery=true) 公共列表查找列表(整数id); 获取非法参数异常, 位置超出已声明顺序参数的数量。请记住,序数参数是基于1的!职位:1
位置参数,有时也称必备参数,指的是必须按照正确的顺序将实际参数传到函数中,换句话说,调用函数时传入实际参数的数量和位置都必须和定义函数时保持一致。 实参和形参数量必须一致 在调用函数,指定的实际参数的数量,必须和形式参数的数量一致(传多传少都不行),否则 Python 解释器会抛出 TypeError 异常,并提示缺少必要的位置参数。 例如: 运行结果为: Traceback (most rece
目前为止,我们的脚本示例长这样: #!/bin/bash # sysinfo_page - A script to produce a system information HTML file ##### Constants TITLE="System Information for $HOSTNAME" RIGHT_NOW=$(date +"%x %r %Z") TIME_STAMP="U
我正在使用Hibernate/JPA执行本机PostGIS查询。这些查询的问题在于它们需要不是经典X='value'形式的参数。 我的问题是:- 错误:- 有人知道如何解决这种情况吗?