gpt4 book ai didi

java.lang.ClassCastException : org. hibernate.hql.ast.tree.SqlNode 无法转换为 org.hibernate.hql.ast.tree.FromReferenceNode

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:00:26 28 4
gpt4 key购买 nike

我正在尝试使用 HQL 查询更新记录,但我收到了 CastException。如果有人可以帮助我,我将不胜感激。我已经在网上查了一段时间,但我找不到这方面的任何信息。如果您有关于此异常的更多信息,请告诉我。

返回的完整错误信息:

Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: org.hibernate.hql.ast.tree.SqlNode cannot be cast to org.hibernate.hql.ast.tree.FromReferenceNode        at org.hibernate.hql.ast.HqlSqlWalker.generateSyntheticDotNodeForNonQualifiedPropertyRef(HqlSqlWalker.java:495)        at org.hibernate.hql.ast.HqlSqlWalker.lookupNonQualifiedProperty(HqlSqlWalker.java:488)        at org.hibernate.hql.antlr.HqlSqlBaseWalker.propertyRef(HqlSqlBaseWalker.java:1102)        at org.hibernate.hql.antlr.HqlSqlBaseWalker.assignment(HqlSqlBaseWalker.java:1008)        at org.hibernate.hql.antlr.HqlSqlBaseWalker.setClause(HqlSqlBaseWalker.java:729)        at org.hibernate.hql.antlr.HqlSqlBaseWalker.updateStatement(HqlSqlBaseWalker.java:349)        at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:237)        at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:228)        at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)        at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)        at org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:77)        at org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:56)        at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)        at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)        at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)        at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)        at Database.HibernateConnection.updateFlight(HibernateConnection.java:161)        at Controller.Controller.ChangeFlight(Controller.java:527)        at View.CreateChangeFlightView.btnSaveActionPerformed(CreateChangeFlightView.java:738)        at View.CreateChangeFlightView.access$1000(CreateChangeFlightView.java:45)        at View.CreateChangeFlightView$6.actionPerformed(CreateChangeFlightView.java:299)        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)        at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)        at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)        at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)        at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)        at java.awt.Component.processMouseEvent(Component.java:6263)        at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)        at java.awt.Component.processEvent(Component.java:6028)        at java.awt.Container.processEvent(Container.java:2041)        at java.awt.Component.dispatchEventImpl(Component.java:4630)        at java.awt.Container.dispatchEventImpl(Container.java:2099)        at java.awt.Component.dispatchEvent(Component.java:4460)        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)        at java.awt.Container.dispatchEventImpl(Container.java:2085)        at java.awt.Window.dispatchEventImpl(Window.java:2478)        at java.awt.Component.dispatchEvent(Component.java:4460)        at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)        at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

查询:删除

最佳答案

问题是因为from是HQL中的保留字。由于无法在 HQL 中转义关键字,因此唯一可能的解决方案是重命名该字段。

关于java.lang.ClassCastException : org. hibernate.hql.ast.tree.SqlNode 无法转换为 org.hibernate.hql.ast.tree.FromReferenceNode,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7716729/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com