My Hibernate generate query from HQL but cannot find view!!!
I can executed query easily and gain result manualy but Hibernate can't!!!
I have too many other entities that mapped to other tables or views and too many HQL query that work well and this query does not have any different from others. Just I changed my DB from oracle 9i to 10g and the view created after migration.
Hibernate version: 3
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Exception occurred during event dispatching:
javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:630)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:75)
at ir.mas.cama.services.persistence.PersistenceServiceImpl.executeJPAQuery(PersistenceServiceImpl.java:133)
at ir.mas.cama.services.persistence.PersistenceServiceImpl.getComparePriceInformation(PersistenceServiceImpl.java:1350)
at ir.mas.cama.desktop.form.formsWithMap.MapAndInfoFacade.showCompareLandsMapAndPriceInformation(MapAndInfoFacade.java:1198)
at ir.mas.cama.desktop.form.formsWithMap.compareSearches.ListSearchesDialog.comparePriceButtonActionPerformed(ListSearchesDialog.java:220)
at ir.mas.cama.desktop.form.formsWithMap.compareSearches.ListSearchesDialog.access$0(ListSearchesDialog.java:216)
at ir.mas.cama.desktop.form.formsWithMap.compareSearches.ListSearchesDialog$1.actionPerformed(ListSearchesDialog.java:86)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.Dialog$1.run(Unknown Source)
at java.awt.Dialog$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Dialog.show(Unknown Source)
at java.awt.Component.show(Unknown Source)
at java.awt.Component.setVisible(Unknown Source)
at java.awt.Window.setVisible(Unknown Source)
at java.awt.Dialog.setVisible(Unknown Source)
at ir.mas.cama.desktop.Main.onCompareLandsMenuItemClicked(Main.java:1220)
at ir.mas.cama.desktop.Main$15.actionPerformed(Main.java:633)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:2223)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
at org.hibernate.loader.Loader.list(Loader.java:2099)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:66)
... 65 more
Caused by: java.sql.SQLException: ORA-00942: table or view does not exist
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:799)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1039)
at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:839)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1132)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3285)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3329)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
at org.hibernate.loader.Loader.doQuery(Loader.java:674)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:2220)
... 73 more
Name and version of the database you are using: Oracle 10g
The generated SQL (show_sql=true):
Hibernate:
/* select
distinct cr
from
ComparePriceResult cr,
SearchResult sr
where
sr.searchNo=1216
and sr.blockNo = cr.id.blockNo
and sr.landNo = cr.id.landNo
order by
cr.id.blockNo,
cr.id.landNo */ select
distinct comparepri0_.ZONE_NO as ZONE1_23_,
comparepri0_.APARTMENT_NO as APARTMENT2_23_,
comparepri0_.BLOCK_NO as BLOCK3_23_,
comparepri0_.BUILD_AREA as BUILD4_23_,
comparepri0_.BUILD_AREA_PRICE as BUILD5_23_,
comparepri0_.BUILDING_NO as BUILDING6_23_,
comparepri0_.LAND_AREA as LAND7_23_,
comparepri0_.LAND_AREA_PRICE as LAND8_23_,
comparepri0_.LAND_NO as LAND9_23_,
comparepri0_.MODEL_PROPERTIY_TYPE as MODEL10_23_,
comparepri0_.REGION_NO as REGION11_23_,
comparepri0_.TOTAL_PRICE as TOTAL12_23_
from
COMPARE_PRICE_LAND comparepri0_,
TEMPORARY_RESULT searchresu1_
where
searchresu1_.SEARCH_NO=1216
and searchresu1_.BLOCK_NO=comparepri0_.BLOCK_NO
and searchresu1_.LAND_NO=comparepri0_.LAND_NO
order by
comparepri0_.BLOCK_NO,
comparepri0_.LAND_NO
16:22:23,312 WARN JDBCExceptionReporter:77 - SQL Error: 942, SQLState: 42000
16:22:23,312ERROR JDBCExceptionReporter:78 - ORA-00942: table or view does not exist
|