一个hql 关键字member(非mysql)引起的 vo 数据 保存数据库错误

2015-03-19 14:16:29,285 ERROR [Thread-3] (DAOHelper.java:312) - updateByEntityPK:com.agileeagle.dao.webgame.entity.UnionInfo@16dc54d
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.<init>(HQLQueryPlan.java:77)
 at org.hibernate.engine.query.HQLQueryPlan.<init>(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 org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:93)
 at sun.reflect.GeneratedMethodAccessor705.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:240)
 at $Proxy22.createQuery(Unknown Source)
 at com.agileeagle.dao.core.support.HibernateBeanHelper.updateByPK(HibernateBeanHelper.java:294)
 at com.agileeagle.dao.core.DAOHelper.updateByEntityPK(DAOHelper.java:308)
 at com.agileeagle.webgame.game.service.imp.CacheService.updateEntityList(CacheService.java:60)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
 at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
 at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
 at $Proxy28.updateEntityList(Unknown Source)
 at com.agileeagle.webgame.game.service.imp.CacheStore.updateEntityList0(CacheStore.java:90)
 at com.agileeagle.webgame.game.service.imp.CacheStore.updateEntityList(CacheStore.java:120)
 at com.agileeagle.webgame.framework.cache.AbstractPersistCache.persist(AbstractPersistCache.java:432)
 at com.agileeagle.webgame.game.cache.imp.UnionCache.persist(UnionCache.java:515)
 at com.agileeagle.webgame.game.DebugGameServer$DebugThread.persist(DebugGameServer.java:150)
 at com.agileeagle.webgame.game.DebugGameServer$DebugThread.run(DebugGameServer.java:66)
2015-03-19 14:16:29,296 ERROR [Thread-3] (CacheService.java:66) - BATCH UPDATE class com.agileeagle.dao.webgame.entity.UnionInfo SET:[{"build":1800,"dissolveSec":0,"leader":80001  。。。

 

---》 上边是三国军团对象保存数据库时发生的异常,经过不断的测试,原来是 hql 关键字异常,即我的军团中用到了 member 为成员属性,而member刚好是hql 中的关键字,所以保存出错出现异常了。在测试服过程中,原来是以为 是mysql 关键字异常,结果测试不是的,而是hql的关键字异常。

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。