新人求救!spring全注解写法中hql语句错误
说是数据库语句错误,但是实体已经查出来了啊,很费解,新人求救啊!
语句如下:from TopUp where die=0 and giving.gid='"+topUp.getGiving().getGid()+"'
错误信息如下:Struts Problem Report
Struts has detected an unhandled exception:
Messages:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from Giving where die=0 and gid='1'' at line 1
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from Giving where die=0 and gid='1'' at line 1
File: org/hibernate/exception/internal/SQLExceptionTypeDelegate.java
Line number: 82
Stacktraces
org.hibernate.exception.SQLGrammarException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from Giving where die=0 and gid='1'' at line 1
org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:82)
org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)
org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125)
org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110)
org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:129)
org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81)
$Proxy38.executeQuery(Unknown Source)
org.hibernate.loader.Loader.getResultSet(Loader.java:1953)
org.hibernate.loader.Loader.doQuery(Loader.java:829)
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:289)
org.hibernate.loader.Loader.doList(Loader.java:2438)
org.hibernate.loader.Loader.doList(Loader.java:2424)
org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2254)
org.hibernate.loader.Loader.list(Loader.java:2249)
org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:331)
org.hibernate.internal.SessionImpl.listCustomQuery(SessionImpl.java:1784)
org.hibernate.internal.AbstractSessionImpl.list(AbstractSessionImpl.java:229)
org.hibernate.internal.SQLQueryImpl.list(SQLQueryImpl.java:156)
com.guoyilin.dao.daoImpl.GivingDaoImpl.findByGivingId(GivingDaoImpl.java:46)
com.guoyilin.service.serviceImpl.GivingServiceImpl.findByGivingId(GivingServiceImpl.java:47)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)