Hibernate - table is not mapped,有点怪.
抛出如下异常:Caused by: Caused by: org.hibernate.hql.ast.QuerySyntaxException:T_RE_DEV is not mapped [SELECT new Map(MTRX.DEV_TYP_CD as typ,MTRX.Dev_Mdl_Cd as mdl,MTRX.PRES_CLLC_MTHD as mthd,MTRX.PRES_CLLC_SRC as src, MTRX.BS_SOFT_INF as soft_inf ) FROM T_RE_DEV DEV, T_CD_PRES_CLLC_PTRN_MTRX MTRX WHERE DEV.dev_id=? AND MTRX.dev_mdl_cd=DEV.dev_mdl_cd AND MTRX.dev_typ_cd=DEV.dev_typ_cd AND ( INSTR(DEV.bs_soft_inf, MTRX.bs_soft_inf)>0 OR MTRX.bs_soft_inf = 'all')]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: T_RE_DEV is not mapped [SELECT new Map(MTRX.DEV_TYP_CD as typ, MTRX.Dev_Mdl_Cd as mdl, MTRX.PRES_CLLC_MTHD as mthd,MTRX.PRES_CLLC_SRC as src, MTRX.BS_SOFT_INF as soft_inf ) FROM T_RE_DEV DEV, T_CD_PRES_CLLC_PTRN_MTRX MTRX WHERE DEV.dev_id=? AND MTRX.dev_mdl_cd=DEV.dev_mdl_cd AND MTRX.dev_typ_cd=DEV.dev_typ_cd AND (INSTR(DEV.bs_soft_inf, MTRX.bs_soft_inf)>0 OR MTRX.bs_soft_inf = 'all')]]
按说应该是T_RE_DEV这个表没有配置而导致,但是我在前面有调用的DAO中,也使用到了这个表,其hibernate_sql如下:
Hibernate: select tredev0_.DEV_ID as DEV1_85_, tredev0_.SHLF_DEV_ID as SHLF2_85_, tredev0_.LGCL_DEV_ID as LGCL3_85_, tredev0_.DEV_MDL_CD as DEV4_85_, tredev0_.DEV_CALL_NM as DEV5_85_, tredev0_.DEV_NO as DEV6_85_, tredev0_.VND_CD as VND7_85_, tredev0_.BLDG_CD as BLDG8_85_, tredev0_.DEV_SRL_NO as DEV9_85_, tredev0_.BS_SOFT_INF as BS10_85_, tredev0_.RACK_ID as RACK11_85_, tredev0_.LGCL_STEP as LGCL12_85_, tredev0_.LGCL_RANK as LGCL13_85_, tredev0_.NEW_SET_CNST_SCH_DY as NEW14_85_, tredev0_.NEW_SET_CNST_NM as NEW15_85_, tredev0_.NEW_SET_CNST_PLAN_NO as NEW16_85_, tredev0_.RMV_CNST_SCH_DY as RMV17_85_, tredev0_.RMV_CNST_NM as RMV18_85_, tredev0_.RMV_CNST_PLAN_NO as RMV19_85_, tredev0_.ATCL_CONT as ATCL20_85_, tredev0_.EQP_CNDT_CD as EQP21_85_, tredev0_.UPD_DT as UPD22_85_, tredev0_.CTL_IPV4_AD as CTL23_85_, tredev0_.THGS_MST_CD as THGS24_85_, tredev0_.DEL_FLG as DEL25_85_, tredev0_.FUNC_TYP_CD as FUNC26_85_, tredev0_.DEV_TYP_CD as DEV27_85_ from T_RE_DEV tredev0_ where tredev0_.DEV_CALL_NM=?
而且也查证了该配置文件存在,切配置正确(否则上述dao不可能运行成功),怀疑是sql SELECT new Map(...) from ... 的问题,贴出来麻烦大家帮忙查查...
Caused by: Caused by: org.hibernate.hql.ast.QuerySyntaxException: T_RE_DEV is not mapped [SELECT new Map( MTRX.DEV_TYP_CD as typ, MTRX.Dev_Mdl_Cd as mdl, MTRX.PRES_CLLC_MTHD as mthd, MTRX.PRES_CLLC_SRC as src, MTRX.BS_SOFT_INF as soft_inf ) FROM T_RE_DEV DEV, T_CD_PRES_CLLC_PTRN_MTRX MTRX WHERE DEV.dev_id=? AND MTRX.dev_mdl_cd=DEV.dev_mdl_cd AND MTRX.dev_typ_cd=DEV.dev_typ_cd AND ( INSTR(DEV.bs_soft_inf, MTRX.bs_soft_inf)>0 OR MTRX.bs_soft_inf = 'all' )]
at org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:158)
at org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:87)
at org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClause.java:70)
at org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:255)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3056)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2945)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:688)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:544)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:228)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
at org.springframework.orm.hibernate3.HibernateTemplate$37.doInHibernate(HibernateTemplate.java:1029)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372)
at org.springframework.orm.hibernate3.HibernateTemplate.iterate(HibernateTemplate.java:1027)
at ngnops.rft.dao.RftPatternMatrixDAOImpl.findModelPatternMatrixByDevId(RftPatternMatrixDAOImpl.java:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.aop.interceptor.AbstractTraceInterceptor.invoke(AbstractTraceInterceptor.java:113)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy5.findModelPatternMatrixByDevId(Unknown Source)
at ngnops.rft.service.RftBatchReflect$WorkerThread.devCheck(RftBatchReflect.java:312)
at ngnops.rft.service.RftBatchReflect$WorkerThread.run(RftBatchReflect.java:281)