zoukankan      html  css  js  c++  java
  • 数据库 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() ~[mes-system-v3.0.jar:na]
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.3.4.RELEASE.jar:4.3.4.RELEASE]
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720) ~[spring-aop-4.3.4.RELEASE.jar:4.3.4.RELEASE]
    解决方法:jdbc.url=jdbc:mysql:/localhost:3306/project?useOldAliasMetadataBehavior=true

  • 相关阅读:
    Linux下面编译安装ffmpeg
    Fidder简单使用方法(HTTPS抓取和url替换)
    关于一下个阶段的计划
    JAVA的随机的字符串的封装(基本上够用了)
    Shell Script中的间接变量引用
    进程概念
    int main(int argc, char *argv[])的解读
    存储数组数据到SharedPreferences
    C语言中的基本声明
    C中关于指针数组的用法
  • 原文地址:https://www.cnblogs.com/chonghaojie/p/10383214.html
Copyright © 2011-2022 走看看