依赖如下:
sql以及执行情况如下:
String strHql = "FROM Catalog t WHERE t.status not in('1', '2', '3', '4', '5', '6') ORDER BY t.orderNum, t.id";
HibernateTemplate.execute( new HibernateCallback() {
public Object doInHibernate(Session session) throws
HibernateException, SQLException {
Query query = session.createQuery(strHql);
ArrayList arrayList = (ArrayList) query.list();
return arrayList;
}});
报错如下:
WARN [(hibernate.util.JDBCExceptionReporter)] SQL Error: -2106, SQLState: 22000
ERROR [(hibernate.util.JDBCExceptionReporter)] 第1 行附近出现错误:
无效的表或视图名[CATALOG]
org.springframework.dao.DataIntegrityViolationException: could not execute query; nested exception is org.hibernate.exception.DataException: could not execute query
报错的上一行有一条Hibernate的转换结果
Hibernate: select xxxxx from CATALOG catalog0_ where catalog0_.STATUS not in ('1' , '2', '3' , '4', '5' , '6') order by catalog0_.ORDERNUM, catalog0_.ID
用户下多模式导致错误,需要在连接串上指定schema,这边指定schema与oracle、mysql等都不一样
jdbc:dm://ip:port?schema=指定模式
登录的用户不对