我的HQL语句是这样写的:
"SELECT a.deviceType,a.typeCount,b.newCount FROM "
+ "((SELECT id,COUNT(deviceType) as typeCount,deviceType FROM Device GROUP BY deviceType) AS a"+
",(SELECT id, COUNT(devicetype) as newCount,deviceType FROM Device WHERE modifyTime>'2011-04-06' GROUP BY deviceType) AS b)" + "WHERE a.deviceType = b.deviceType";
执行query = createQuery(hql);
list = query.list();抛异常 请问这样的SQL语句有什么问题?
"SELECT a.deviceType,a.typeCount,b.newCount FROM "
+ "((SELECT id,COUNT(deviceType) as typeCount,deviceType FROM Device GROUP BY deviceType) AS a"+
",(SELECT id, COUNT(devicetype) as newCount,deviceType FROM Device WHERE modifyTime>'2011-04-06' GROUP BY deviceType) AS b)" + "WHERE a.deviceType = b.deviceType";
执行query = createQuery(hql);
list = query.list();抛异常 请问这样的SQL语句有什么问题?
解决方案 »
- 怎么转行做java编程?
- 请问如何解决oracle blob字段 的乱码问题?
- 使用Spring的hibernateTemplate保存很慢,在线等,求大家!
- Ibatis新手错误
- 如何更改tomcat的主页为我自己的huml页面,在网上查阅的所有方法都失过了,可是还是不行.
- 请高手帮忙解释一下这几个库是干什么的,谢谢
- 小白问一个初级问题请各位大牛不要介意,贴出3行代码和一个错误,求解决方案。
- 使用EJB删除数据库记录的问题
- 失败,请帮个忙
- java在线程中通过hibernate循环去操作数据库,不停的进行事务的处理和session的创建和关闭,会对系统造成什么影响
- java bean问题,急
- 关于tomcat的问题,在线急救!!!!
org.hibernate.hql.ast.QuerySyntaxException: unexpected token: ( near line 1, column 49 [SELECT a.deviceType,a.typeCount,b.newCount FROM ((SELECT id,COUNT(deviceType) as typeCount,deviceType FROM com.eshore.est.entity.datamgr.Device GROUP BY deviceType) AS a,(SELECT id, COUNT(devicetype) as newCount,deviceType FROM com.eshore.est.entity.datamgr.Device WHERE modifyTime>'2011-04-06' GROUP BY deviceType) AS b)WHERE a.deviceType = b.deviceType]
at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:54)
at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:47)
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:82)
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:284)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:182)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:94)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1651)
at org.springside.modules.orm.hibernate.SimpleHibernateDao.createQuery(SimpleHibernateDao.java:238)
at com.eshore.est.dao.datamgr.DeviceDao.queryStatisticOfTools(DeviceDao.java:48)
at com.eshore.est.service.datamgr.DeviceManager.queryStatisticOfTools(DeviceManager.java:64)
at com.eshore.est.service.datamgr.DeviceManager$$FastClassByCGLIB$$eb6ba43d.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:688)
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.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621)
at com.eshore.est.service.datamgr.DeviceManager$$EnhancerByCGLIB$$7d1f669c.queryStatisticOfTools(<generated>)
at com.eshore.est.web.datamgr.DeviceAction.statisticTools(DeviceAction.java:119)