hql unexpected token: exchange

 

ORB.thread.pool : 0line 1:173: unexpected token: exchange
	at org.hibernate.hql.internal.antlr.HqlBaseParser.atom(HqlBaseParser.java:3556)
	at org.hibernate.hql.internal.antlr.HqlBaseParser.unaryExpression(HqlBaseParser.java:3250)
	at org.hibernate.hql.internal.antlr.HqlBaseParser.multiplyExpression(HqlBaseParser.java:3122)
	at org.hibernate.hql.internal.antlr.HqlBaseParser.additiveExpression(HqlBaseParser.java:2828)
	at org.hibernate.hql.internal.antlr.HqlBaseParser.concatenation(HqlBaseParser.java:568)
	at org.hibernate.hql.internal.antlr.HqlBaseParser.relationalExpression(HqlBaseParser.java:2595)
	at org.hibernate.hql.internal.antlr.HqlBaseParser.equalityExpression(HqlBaseParser.java:2551)
	at org.hibernate.hql.internal.antlr.HqlBaseParser.negatedExpression(HqlBaseParser.java:2420)
	at org.hibernate.hql.internal.antlr.HqlBaseParser.logicalAndExpression(HqlBaseParser.java:2336)
	at org.hibernate.hql.internal.antlr.HqlBaseParser.logicalOrExpression(HqlBaseParser.java:2301)
	at org.hibernate.hql.internal.antlr.HqlBaseParser.expression(HqlBaseParser.java:2011)
	at org.hibernate.hql.internal.antlr.HqlBaseParser.logicalExpression(HqlBaseParser.java:1787)
	at org.hibernate.hql.internal.antlr.HqlBaseParser.whereClause(HqlBaseParser.java:452)
	at org.hibernate.hql.internal.antlr.HqlBaseParser.queryRule(HqlBaseParser.java:707)
	at org.hibernate.hql.internal.antlr.HqlBaseParser.selectStatement(HqlBaseParser.java:294)
	at org.hibernate.hql.internal.antlr.HqlBaseParser.statement(HqlBaseParser.java:157)
	at org.hibernate.hql.internal.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:268)
	at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:182)
	at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:138)
	at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:105)
	at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
	at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:168)
	at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:221)
	at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:199)
	at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1784)
	at com.shkco.adsr3.framework.dao.SessionWrapper.createQueryWrapper(SessionWrapper.java:159)
	at com.shkco.adsr3.framework.dao.SessionWrapper.createQuery(SessionWrapper.java:155)
	at com.shkco.adsr3.staticdata.dao.ProductLineDAO.getOSProductLineByExchangeId(ProductLineDAO.java:190)
	at com.shkco.adsr3.staticdata.service.ProductLineService.getOSProductLineByExchangeId(ProductLineService.java:237)
	at com.shkco.adsr3.frontoffice.omos.service.OSOrderInputMode1Service.preload(OSOrderInputMode1Service.java:250)
	at com.shkco.adsr3.frontoffice.omos.activity.OSOrderInputMode1PreloadActivity.perform(OSOrderInputMode1PreloadActivity.java:54)
	at com.shkco.adsr3.framework.ejb.AppControllerBean.handleEvent(AppControllerBean.java:309)
	at com.shkco.adsr3.framework.ejb.EJSRemoteStatelessAppController_9b2df7f6.handleEvent(Unknown Source)
	at com.shkco.adsr3.framework.ejb._EJSRemoteStatelessAppController_9b2df7f6_Tie.handleEvent(Unknown Source)
	at com.shkco.adsr3.framework.ejb._EJSRemoteStatelessAppController_9b2df7f6_Tie._invoke(Unknown Source)
	at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:678)
	at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:525)
	at com.ibm.rmi.iiop.ORB.process(ORB.java:578)
	at com.ibm.CORBA.iiop.ORB.process(ORB.java:1578)
	at com.ibm.rmi.iiop.Connection.doRequestWork(Connection.java:3076)
	at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2946)
	at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:64)
	at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:118)
	at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1862)

 

String hql = "SELECT productLine FROM " + ProductLine.class.getSimpleName() 
+ " as productLine " 
+ " join productLine.exchange as exchange " 
+ " where e.exchangeId = :exchangeId ";

 将上面hql 的别名exchange 改为e,这个别名不能与前面的join后面的对象命名一样

String hsql = "SELECT productLine FROM " 
+ ProductLine.class.getSimpleName() + " as productLine " 
+ " join productLine.exchange as e " 
+ " where e.exchangeId = :exchangeId ";

 

 

 

你可能感兴趣的:(hql unexpected token: exchange)