我必須添加一個字符串數組到IN子句。休眠IN子句顯示錯誤
我的Hibernate查詢是這樣的,
Query q =
session.createQuery("from CsePrcsngGroup where CSE_SID=? and CSE_GROUP IN(:cseGrpLists)");
q.setParameter(0, cseSid);
q.setParameterList("cseGrpLists", cseGrpLists);
return q.list();
其中CsePrcsngGroup是我的實體類。 CSE_SID和CSE_GROUP是字段名稱,cseGrpLists是一個字符串數組。
我得到執行此錯誤時拋出,
Caused by: java.sql.SQLException: ORA-00942: table or view does not exist
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:138)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:316)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:282)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:639)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:185)
at oracle.jdbc.driver.T4CPreparedStatement.execute_for_describe(T4CPreparedStatement.java:503)
at oracle.jdbc.driver.OracleStatement.execute_maybe_describe(OracleStatement.java:1029)
at oracle.jdbc.driver.T4CPreparedStatement.execute_maybe_describe(T4CPreparedStatement.java:535)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1126)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3001)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3043)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1849)
at org.hibernate.loader.Loader.doQuery(Loader.java:718)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
at org.hibernate.loader.Loader.doList(Loader.java:2294)
... 55 more
Wrapped exception:
org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:92)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.loader.Loader.doList(Loader.java:2297)
有什麼建議?我嘗試使用實體名稱instaed數據庫列名稱,但得到相同的錯誤。導致:java.sql.SQLException:ORA-00942:表或視圖不存在
u能顯示實體 – PSR 2013-04-08 12:03:00
你是如何說的錯誤:在第 – PSR 2013-04-08 12:03:33
開啓日誌記錄和考試由Hibernate創建的SQL。使用一些DBMS在相同的連接設置上運行查詢。拋出'ORA-00942'是因爲你沒有訪問Oracle對象的權限。所以問題是查詢輸出或特權。 – 2013-04-08 12:36:29