- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试跟踪此异常,但不理解它,请查看我的异常
并请让我知道我哪里出错了
java.lang.IllegalArgumentException: org.hibernate.QueryException: No data type for node: org.hibernate.hql.internal.ast.tree.MethodNode
\-[METHOD_CALL] MethodNode: '('
+-[METHOD_NAME] IdentNode: 'STR_TO_DATE' {originalText=STR_TO_DATE}
\-[EXPR_LIST] SqlNode: 'exprList'
+-[DOT] DotNode: 'feetermdat4_.date' {propertyName=date,dereferenceType=PRIMITIVE,getPropertyPath=date,path=ff.date,tableAlias=feetermdat4_,className=com.rasvek.cg.entity.FeeTermDates,classAlias=ff}
| +-[ALIAS_REF] IdentNode: 'feetermdat4_.tdm_id' {alias=ff, className=com.rasvek.cg.entity.FeeTermDates, tableAlias=feetermdat4_}
| \-[IDENT] IdentNode: 'date' {originalText=date}
\-[QUOTED_STRING] LiteralNode: ''%d/%m/%Y''
[select STR_TO_DATE(ftd.date, '%d/%m/%Y') as installmentDate,sum(fi.amount) as installmentAmount from com.rasvek.cg.entity.AssocFeeStudent afs,com.rasvek.cg.entity.FeeTermDates ftd ,com.rasvek.cg.entity.FeeClassMapping fcm ,com.rasvek.cg.entity.FeeIntallments fi where fcm.feeCategory.feeCatId= :fcmFeeCatId and fi.feeClassMappingId=fcm.feeClassMappingId and afs.feeCategory.feeCatId= :afsFeeCatId and afs.studentDetails.studentAdmissionId= :studentAdmissionId and fi.termDateId=ftd.tdmId and STR_TO_DATE(fi.termDate, '%d/%m/%Y') <= ( select STR_TO_DATE(ff.date, '%d/%m/%Y') from com.rasvek.cg.entity.FeeTermDates ff where ff.tdmId= :ffTdmId) order by STR_TO_DATE(ftd.date, '%d/%m/%Y') asc]
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:133)
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:157)
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:164)
at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:670)
at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:103)
at com.rasvek.cms.dao.MasterDaoImpl.getNewpaymentByStuIdNTermId(MasterDaoImpl.java:2531)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:52)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
at com.sun.proxy.$Proxy548.getNewpaymentByStuIdNTermId(Unknown Source)
at com.rasvek.cms.service.MasterSeviceImpl.getNewpaymentByStuIdNTermId(MasterSeviceImpl.java:710)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:52)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
at com.sun.proxy.$Proxy549.getNewpaymentByStuIdNTermId(Unknown Source)
at com.rasvek.cms.controller.MasterController.getNewpaymentByStuIdNTermId(MasterController.java:1907)
at com.rasvek.cms.controller.MasterController$$FastClassBySpringCGLIB$$c2eff8c2.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:52)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673)
at com.rasvek.cms.controller.MasterController$$EnhancerBySpringCGLIB$$7421bf48.getNewpaymentByStuIdNTermId(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1100)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:687)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
我能够理解它,在我看来一切都是正确的,但我遇到了异常。
请查看我的查询:
select
STR_TO_DATE(ftd.date, '%d/%m/%Y') as installmentDate,
sum(fi.amount) as installmentAmount
from AssocFeeStudent afs, FeeTermDates ftd, FeeClassMapping fcm, FeeIntallments fi
where
fcm.feeCategory.feeCatId = :fcmFeeCatId and fi.feeClassMappingId = fcm.feeClassMappingId and afs.feeCategory.feeCatId = :afsFeeCatId and
afs.studentDetails.studentAdmissionId = :studentAdmissionId and fi.termDateId = ftd.tdmId and
STR_TO_DATE(fi.termDate, '%d/%m/%Y') <= (select STR_TO_DATE(ff.date, '%d/%m/%Y')
from FeeTermDates ff
where ff.tdmId = :ffTdmId)
order by STR_TO_DATE(ftd.date, '%d/%m/%Y') asc
在我看来,上述查询看起来是正确的,但有些地方出了问题。 但是相同的查询在我的 mysql WorkBench 中完美运行。
最佳答案
问题是您正在尝试使用 Hibernate 不支持的 STR_TO_DATE
SQL 函数 query language .
您可能不想使用 HQL,而是使用 Hibernate 的 native query support ,它让您执行简单的 SQL
List<Object[]> result = entityManager.createNativeQuery("your query here")
.getResultList();
但是,您将失去 ORM 的优势,并在标量值列表的 for 中获得结果。
但是您根本不需要使用 STR_TO_DATE
转换日期,您可以直接使用 Date
实例作为 HQL 查询中的参数,即
session.createQuery("from FeeIntallments fi where where fi.termDateId >= :date")
.setParameter("date", new Date())
.list()
关于java.lang.IllegalArgumentException : org. hibernate.QueryException : No data type for node: org. hibernate.hql.internal.ast.tree.MethodNode,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50792165/
我有实体和 NamedQuery: @Entity @Table(name="MY_TABLE") @NamedQueries({ @NamedQuery(name="myQuery", quer
hql 中的 row_number() 与分区的等价物是什么 我在 hql 中有以下查询: select s.Companyname, p.Productname, sum(od.Unitprice
hql 函数 current_timestamp() 使用的是来自运行 java 代码的服务器的时间还是来自运行数据库的服务器的时间? 最佳答案 HQL 查询被翻译成 SQL 查询,SQL 查询由数据
我有一个 Hibernate HQL 问题。 我想将子查询编写为派生表(出于性能原因)。 可以在 HQL 中做到这一点吗? 例子: FROM Customer WHERE country.id in
我有三个表 A B 和 C。现在我想在 HQL 中执行这个 sql 查询: select * from A as a left join B as b on a.id = b.id left join
我是 Hive 的新手,想知道如何直接从 .hql 文件执行 hive 命令。 最佳答案 如 @rajshukla4696 所述,hive -f filename.hql 或 beeline -f f
出于各种原因,我正在尝试编写一个部分动态的 HQL 查询,而不求助于 Criteria API。我想知道是否有一种简单的方法可以使用 HQL 表达式来短路 where 限制。例如,这是工作正常的原始查
我正在自学 hibernate ,并且很困惑为什么我不能只编写简单的 SQL 查询。 我发现它比普通 SQL(我习惯的)使用起来更困惑 PLUS:我发现 NetBeans HQL 编辑器非常烦人,对我
非常感谢您帮助将以下 SQL 语句转换为有效的 HQL 语句。我尝试了几个小时但没有成功: SELECT * FROM master as m left outer join (select * fr
我有一个 HQL 查询: query = select item.itemNumber from items item where item.stock>0 and item.price it = q
我在以下代码段中遇到错误 using (var session = Database.OpenSession()) { var q = from x in session.Query()
我正在使用以下 C# 代码: public IList GetAllByExpression(Expression> expression, int startIndex, int count, Fu
我有 HQL,我试图在其中获取没有分类的工件(当 Activity 为 0 时) artifacts = Artifact.findAll("FROM Artifact WHERE id NOT IN
在 JPQL 中,我可以通过以下方式检索实体: query = entityManager.createQuery("select c from Category c"); List categori
我正在尝试使用 HQL 查询更新记录,但我收到了 CastException。如果有人可以帮助我,我将不胜感激。我已经在网上查了一段时间,但我找不到这方面的任何信息。如果您有关于此异常的更多信息,请告
我正在尝试在 JPA 中执行一个 select 语句,这会抛出上述错误。代码是: TypedQuery typedQuery = null; String query = ""; List list
我有问题要执行一个更新 HQL 查询。 我想编辑保存在配置文件实体中的值,但没有运气。 我的实体如下所示 @Entity @Table(name = "users", catalog = "testd
如何设置此 hql 查询的限制?当我在查询中添加 limit 关键字时,会引发错误。 @Query("from voucher v where v.voucherType.typeDescript
假设有两个表,A[a_id, b_id]和 B[b_id,c] . 我需要执行表单 "From A a ORDER BY a.b.c" 的 HQL 查询, 而 b在类 A 中可以为空. 但是,该查询仅
是否可以在 HQL 中运行与此类似的查询而无需指定所有列名。 select med, MAX(med.PrescriptionLines.Prescription.PrescriptionDate)
我是一名优秀的程序员,十分优秀!