数据库oracle改成mysql后Hibernate不能使用别名问题

报错:
[INFO ] 11:34:19.272 [http-apr-7081-exec-8] org.hibernate.type.StringType - could not read column value from result set: PK_ID; Column 'PK_ID' not found.
[WARN ] 11:34:19.274 [http-apr-7081-exec-8] o.h.util.JDBCExceptionReporter - SQL Error: 0, SQLState: S0022
[ERROR] 11:34:19.274 [http-apr-7081-exec-8] o.h.util.JDBCExceptionReporter - Column 'PK_ID' not found.
[INFO ] 11:34:19.336 [http-apr-7081-exec-8] c.w.l.common.aop.ExceptionHandler - could not execute query
org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:92) ~[hibernate-core-3.5.5-Final.jar:3.5.5-Final]
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) ~[hibernate-core-3.5.5-Final.jar:3.5.5-Final]
at org.hibernate.loader.Loader.doList(Loader.java:2452) ~[hibernate-core-3.5.5-Final.jar:3.5.5-Final]
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2192) ~[hibernate-core-3.5.5-Final.jar:3.5.5-Final]
at org.hibernate.loader.Loader.list(Loader.java:2187) ~[hibernate-core-3.5.5-Final.jar:3.5.5-Final]
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:316) ~[hibernate-core-3.5.5-Final.jar:3.5.5-Final]
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1832) ~[hibernate-core-3.5.5-Final.jar:3.5.5-Final]
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165) ~[hibernate-core-3.5.5-Final.jar:3.5.5-Final]
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:179) ~[hibernate-core-3.5.5-Final.jar:3.5.5-Final]
at com.wisdytech.linkmes.system.dao.impl.ResourceDaoImpl.getAllResourceTree(ResourceDaoImpl.java:233) ~[mes-system-v3.0.jar:na]
at com.wisdytech.linkmes.system.service.impl.ResourceServiceImpl.getAllResourceTree(ResourceServiceImpl.java:394) ~[mes-system-v3.0.jar:na]
at com.wisdytech.linkmes.system.service.impl.ResourceServiceImpl$$FastClassBySpringCGLIB$$e300c3f5.invoke(

猜你喜欢

转载自www.cnblogs.com/chonghaojie/p/10383214.html