[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3364?page=c...
]
Istvan Kovacs commented on HHH-3364:
------------------------------------
Thanks for the explanation. My only grief is that if it's invalid syntax, I think the
parser should say so. Instead, invalid SQL is generated. In the other bug, HHH-1350, a
parser exception is reported. Here we have a JDBC exception instead, caused by the invalid
SQL.
Missing table name + alias in FROM clause of generated SQL
----------------------------------------------------------
Key: HHH-3364
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3364
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.6, 3.3.0.CR1
Environment: hsqldb
Reporter: Istvan Kovacs
Assignee: Diego Plentz
Same sources as HHH-3362 and HHH-3363
select emp.name
from
Employee emp, Product p
where
emp.shop.stock[p] > 5
and
p.name='Product_10'
SQL (missing the table SHOP, aliased as shop_2)
select
employee0_.name as col_0_0_
from
Employee employee0_,
PRODUCT product1_,
SHOP_PRODUCT_STOCK stock3_
where
employee0_.SHOP_ID=shop2_.SHOP_ID
and shop2_.SHOP_ID=stock3_.SHOP_ID
and stock3_.PRODUCT_ID = product1_.PRODUCT_ID
and stock3_.AMOUNT>5
and product1_.name='Product_10'
Stack trace is from 3.3.0.CR1, but problem is also present in 3.2.6
java.sql.SQLException: Column not found: SHOP2_.SHOP_ID in statement [select
employee0_.name as col_0_0_ from Employee employee0_, PRODUCT product1_,
SHOP_PRODUCT_STOCK stock3_ where employee0_.SHOP_ID=shop2_.SHOP_ID and
shop2_.SHOP_ID=stock3_.SHOP_ID and stock3_.PRODUCT_ID = product1_.PRODUCT_ID and
stock3_.AMOUNT>5 and product1_.name='Product_10']
at org.hsqldb.jdbc.Util.throwError(Unknown Source)
at org.hsqldb.jdbc.jdbcPreparedStatement.<init>(Unknown Source)
at org.hsqldb.jdbc.jdbcConnection.prepareStatement(Unknown Source)
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:505)
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:423)
at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547)
at org.hibernate.loader.Loader.doQuery(Loader.java:673)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:2220)
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.console.HQLQueryPage.getList(HQLQueryPage.java:50)
at
org.hibernate.eclipse.console.views.QueryPageViewer$ContentProviderImpl.getElements(QueryPageViewer.java:114)
at org.eclipse.jface.viewers.StructuredViewer.getRawChildren(StructuredViewer.java:937)
at org.eclipse.jface.viewers.ColumnViewer.getRawChildren(ColumnViewer.java:693)
at
org.eclipse.jface.viewers.AbstractTableViewer.getRawChildren(AbstractTableViewer.java:1071)
at
org.eclipse.jface.viewers.StructuredViewer.getFilteredChildren(StructuredViewer.java:871)
at
org.eclipse.jface.viewers.StructuredViewer.getSortedChildren(StructuredViewer.java:994)
at
org.eclipse.jface.viewers.AbstractTableViewer.internalRefreshAll(AbstractTableViewer.java:685)
at
org.eclipse.jface.viewers.AbstractTableViewer.internalRefresh(AbstractTableViewer.java:633)
at
org.eclipse.jface.viewers.AbstractTableViewer.internalRefresh(AbstractTableViewer.java:620)
at org.eclipse.jface.viewers.AbstractTableViewer$2.run(AbstractTableViewer.java:576)
at
org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1368)
at
org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1330)
at
org.eclipse.jface.viewers.AbstractTableViewer.inputChanged(AbstractTableViewer.java:574)
at org.eclipse.jface.viewers.ContentViewer.setInput(ContentViewer.java:251)
at org.eclipse.jface.viewers.StructuredViewer.setInput(StructuredViewer.java:1606)
at
org.hibernate.eclipse.console.views.QueryPageViewer.createTable(QueryPageViewer.java:218)
at
org.hibernate.eclipse.console.views.QueryPageViewer.createControl(QueryPageViewer.java:197)
at
org.hibernate.eclipse.console.views.QueryPageViewer.<init>(QueryPageViewer.java:154)
at
org.hibernate.eclipse.console.views.QueryPageTabView.rebuild(QueryPageTabView.java:114)
at
org.hibernate.eclipse.console.views.QueryPageTabView$1.contentsChanged(QueryPageTabView.java:78)
at
org.hibernate.eclipse.console.views.QueryPageTabView$1.intervalAdded(QueryPageTabView.java:88)
at javax.swing.AbstractListModel.fireIntervalAdded(Unknown Source)
at org.hibernate.console.QueryPageModel.add(QueryPageModel.java:67)
at
org.hibernate.console.KnownConfigurations$1.queryPageCreated(KnownConfigurations.java:90)
at
org.hibernate.console.ConsoleConfiguration.fireQueryPageCreated(ConsoleConfiguration.java:419)
at org.hibernate.console.ConsoleConfiguration.access$5(ConsoleConfiguration.java:415)
at org.hibernate.console.ConsoleConfiguration$4.execute(ConsoleConfiguration.java:391)
at
org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:65)
at
org.hibernate.console.ConsoleConfiguration.executeHQLQuery(ConsoleConfiguration.java:383)
at org.hibernate.eclipse.hqleditor.HQLEditor.executeQuery(HQLEditor.java:406)
at
org.hibernate.eclipse.console.actions.ExecuteQueryAction.execute(ExecuteQueryAction.java:72)
at
org.hibernate.eclipse.console.actions.ExecuteQueryAction.run(ExecuteQueryAction.java:52)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
at
org.hibernate.eclipse.console.actions.ExecuteQueryAction.runWithEvent(ExecuteQueryAction.java:56)
at
org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:546)
at
org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:490)
at
org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:443)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:169)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:508)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira