Hibernate version:
3.0
Mapping documents:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping package="ru.zenith.dealer.service.hibernate">
<class name="Operatio" table="OPERATIO">
<id name="cod" column="COD" type="java.lang.Integer">
<generator class="sequence" />
</id>
<set name="specific" inverse="true" >
<key column="COD" />
<one-to-many class="Specific" />
</set>
<property name="organ" column="ORGAN" type="java.lang.Integer" not-null="true" />
<property name="data" column="DATA" type="java.util.Date" not-null="true" />
<property name="c_sort" column="C_SORT" type="java.lang.String" not-null="true" />
<property name="c_sort2" column="C_SORT2" type="java.lang.String" not-null="true" />
<property name="codres" column="CODRES" type="java.lang.Integer" not-null="true" />
<property name="creditacc" column="CREDITACC" type="java.lang.String" not-null="true" />
<property name="debetacc" column="DEBETACC" type="java.lang.String" not-null="true" />
<property name="summa" column="SUMMA" type="java.lang.Double" not-null="true" />
<property name="discount" column="DISCOUNT" type="java.lang.Double" not-null="true" />
<property name="kurs" column="KURS" type="java.lang.Double" not-null="true" />
<property name="coduser" column="CODUSER" type="java.lang.Integer" />
<property name="numdocum" column="NUMDOCUM" type="java.lang.String" />
<property name="info" column="INFO" type="java.lang.String" />
<property name="curr" column="CURR" type="java.lang.Integer" />
<property name="bux" column="BUX" type="java.lang.Integer" />
<property name="fields" column="FIELDS" type="java.lang.Integer" />
<property name="sign" column="SIGN" type="java.lang.Integer" />
<property name="c_type_doc" column="C_TYPE_DOC" type="java.lang.Integer" />
<property name="cod_link" column="COD_LINK" type="java.lang.Long" />
<property name="params" column="PARAMS" type="java.lang.String" />
<property name="i_value" column="I_VALUE" type="java.lang.Long" />
<property name="fields2" column="FIELDS2" type="java.lang.Long" />
<property name="fields3" column="FIELDS3" type="java.lang.Long" />
<property name="sign2" column="SIGN2" type="java.lang.Long" />
<property name="sign3" column="SIGN3" type="java.lang.Long" />
<property name="cmplx" column="CMPLX" type="java.lang.Integer" />
<property name="i_order" column="I_ORDER" type="java.lang.Long" />
<property name="log" column="LOG" type="java.lang.Long" />
<property name="cod2" column="COD2" type="java.lang.Long" />
<property name="ntrans" column="NTRANS" type="java.lang.Long" />
<property name="codbop" column="CODBOP" type="java.lang.Long" />
</class>
</hibernate-mapping>
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<class name="Specific" table="SPECIFIC">
<id name="uidcod" column="UIDCOD" type="java.lang.Long">
<generator class="sequence"/>
</id>
<many-to-one name="operatio"
column="COD"
class="Operatio"
not-null="true"/>
<many-to-one name="refgood"
column="CODGOOD"
class="Refgood"
not-null="true"/>
<property name="index" column="NUM" type="java.lang.Integer" not-null="true" />
<property name="cod" column="COD" type="java.lang.Integer" not-null="true" update="false" insert="false"/>
<property name="data" column="DATA" type="java.util.Date" not-null="true" />
<property name="codgood" column="CODGOOD" type="java.lang.Integer" not-null="true" update="false" insert="false"/>
<!-- <property name="num" column="NUM" type="java.lang.Integer" not-null="true" /> -->
<property name="number_" column="NUMBER_" type="java.lang.Integer" not-null="true" />
<property name="price" column="PRICE" type="java.lang.Double" not-null="true" />
<property name="coduser" column="CODUSER" type="java.lang.Integer" not-null="true" />
<property name="fields" column="FIELDS" type="java.lang.Integer" not-null="true" />
<property name="sign" column="SIGN" type="java.lang.Integer" not-null="true" />
<property name="curr" column="CURR" type="java.lang.Integer" not-null="true" />
<property name="codgtd" column="CODGTD" type="java.lang.Integer" />
<property name="cost" column="COST" type="java.lang.Double" />
<property name="pricedil" column="PRICEDIL" type="java.lang.Double" />
<property name="price_" column="PRICE_" type="java.lang.Double" />
<property name="kurs" column="KURS" type="java.lang.Double" />
<property name="data_cr" column="DATA_CR" type="java.util.Date" />
<property name="c_group5" column="C_GROUP5" type="java.lang.Long" />
<property name="last_modi" column="LAST_MODI" type="java.util.Date" />
<property name="zdata_cr" column="ZDATA_CR" type="java.util.Date" />
<property name="comp" column="COMP" type="java.lang.Long" />
<property name="consist" column="CONSIST" type="java.lang.Long" />
<!-- <property name="uidcod" column="UIDCOD" type="java.lang.Long" />-->
<property name="fields2" column="FIELDS2" type="java.lang.Long" />
<property name="fields3" column="FIELDS3" type="java.lang.Long" />
<property name="sign2" column="SIGN2" type="java.lang.Long" />
<property name="sign3" column="SIGN3" type="java.lang.Long" />
<property name="cmplx" column="CMPLX" type="java.lang.Integer" />
<property name="log" column="LOG" type="java.lang.Long" />
<property name="zak" column="ZAK" type="java.lang.Long" />
<property name="uidcod2" column="UIDCOD2" type="java.lang.Long" />
<property name="codres" column="CODRES" type="java.lang.Long" />
</class>
</hibernate-mapping>
Full stack trace of any exception that occurs:org.hibernate.QueryException: expecting 'elements' or 'indices' after: id [select op.specific from ru.zenith.dealer.service.hibernate.Operatio as op where op.cod=8500001]
at org.hibernate.collection.CollectionPropertyMapping.toType(CollectionPropertyMapping.java:45)
at org.hibernate.hql.classic.PathExpressionParser.getPropertyType(PathExpressionParser.java:269)
at org.hibernate.hql.classic.PathExpressionParser.end(PathExpressionParser.java:312)
at org.hibernate.hql.classic.SelectPathExpressionParser.end(SelectPathExpressionParser.java:14)
at org.hibernate.hql.classic.ParserHelper.parse(ParserHelper.java:30)
at org.hibernate.hql.classic.SelectParser.token(SelectParser.java:176)
at org.hibernate.hql.classic.ClauseParser.token(ClauseParser.java:86)
at org.hibernate.hql.classic.ClauseParser.end(ClauseParser.java:113)
at org.hibernate.hql.classic.PreprocessingParser.end(PreprocessingParser.java:122)
at org.hibernate.hql.classic.ParserHelper.parse(ParserHelper.java:30)
at org.hibernate.hql.classic.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:172)
at org.hibernate.hql.classic.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:148)
at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:410)
at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:987)
at org.hibernate.impl.SessionImpl.find(SessionImpl.java:964)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
at org.hibernate.console.HQLQueryPage.getList(HQLQueryPage.java:30)
at org.hibernate.eclipse.console.views.QueryPageViewer$ContentProviderImpl.getElements(QueryPageViewer.java:74)
at org.eclipse.jface.viewers.StructuredViewer.getRawChildren(StructuredViewer.java:765)
at org.eclipse.jface.viewers.TableViewer.getRawChildren(TableViewer.java:1046)
at org.eclipse.jface.viewers.StructuredViewer.getFilteredChildren(StructuredViewer.java:707)
at org.eclipse.jface.viewers.StructuredViewer.getSortedChildren(StructuredViewer.java:822)
at org.eclipse.jface.viewers.TableViewer.internalRefreshAll(TableViewer.java:762)
at org.eclipse.jface.viewers.TableViewer.internalRefresh(TableViewer.java:712)
at org.eclipse.jface.viewers.TableViewer.internalRefresh(TableViewer.java:701)
at org.eclipse.jface.viewers.StructuredViewer$7.run(StructuredViewer.java:1171)
at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1108)
at org.eclipse.jface.viewers.StructuredViewer.refresh(StructuredViewer.java:1169)
at org.eclipse.jface.viewers.StructuredViewer.refresh(StructuredViewer.java:1128)
at org.eclipse.jface.viewers.TableViewer.inputChanged(TableViewer.java:662)
at org.eclipse.jface.viewers.ContentViewer.setInput(ContentViewer.java:248)
at org.eclipse.jface.viewers.StructuredViewer.setInput(StructuredViewer.java:1324)
at org.hibernate.eclipse.console.views.QueryPageViewer.createTable(QueryPageViewer.java:168)
at org.hibernate.eclipse.console.views.QueryPageViewer.createControl(QueryPageViewer.java:147)
at org.hibernate.eclipse.console.views.QueryPageViewer.<init>(QueryPageViewer.java:105)
at org.hibernate.eclipse.console.views.QueryPageTabView.rebuild(QueryPageTabView.java:78)
at org.hibernate.eclipse.console.views.QueryPageTabView$1.contentsChanged(QueryPageTabView.java:47)
at org.hibernate.eclipse.console.views.QueryPageTabView$1.intervalAdded(QueryPageTabView.java:52)
at javax.swing.AbstractListModel.fireIntervalAdded(Unknown Source)
at org.hibernate.console.QueryPageModel.add(QueryPageModel.java:50)
at org.hibernate.console.KnownConfigurations$3.queryPageCreated(KnownConfigurations.java:167)
at org.hibernate.console.ConsoleConfiguration.fireQueryPageCreated(ConsoleConfiguration.java:265)
at org.hibernate.console.ConsoleConfiguration.executeHQLQuery(ConsoleConfiguration.java:246)
at org.hibernate.eclipse.console.actions.ExecuteHQLAction.execute(ExecuteHQLAction.java:99)
at org.hibernate.eclipse.console.actions.ExecuteHQLAction.run(ExecuteHQLAction.java:94)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:996)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:538)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:441)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:842)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2894)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2527)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1570)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1534)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:306)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:228)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:156)
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.core.launcher.Main.invokeFramework(Main.java:315)
at org.eclipse.core.launcher.Main.basicRun(Main.java:268)
at org.eclipse.core.launcher.Main.run(Main.java:942)
at org.eclipse.core.launcher.Main.main(Main.java:926)
org.hibernate.QueryException: unindexed collection before []: operatio0_.specific [select op.specific from ru.zenith.dealer.service.hibernate.Operatio as op where op.cod=8500001]
at org.hibernate.hql.classic.PathExpressionParser.prepareForIndex(PathExpressionParser.java:332)
at org.hibernate.hql.classic.PathExpressionParser.end(PathExpressionParser.java:316)
at org.hibernate.hql.classic.SelectPathExpressionParser.end(SelectPathExpressionParser.java:14)
at org.hibernate.hql.classic.ParserHelper.parse(ParserHelper.java:30)
at org.hibernate.hql.classic.SelectParser.token(SelectParser.java:176)
at org.hibernate.hql.classic.ClauseParser.token(ClauseParser.java:86)
at org.hibernate.hql.classic.ClauseParser.end(ClauseParser.java:113)
at org.hibernate.hql.classic.PreprocessingParser.end(PreprocessingParser.java:122)
at org.hibernate.hql.classic.ParserHelper.parse(ParserHelper.java:30)
at org.hibernate.hql.classic.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:172)
at org.hibernate.hql.classic.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:148)
at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:410)
at org.hibernate.impl.SessionFactoryImpl.getReturnTypes(SessionFactoryImpl.java:616)
at org.hibernate.impl.AbstractQueryImpl.getReturnTypes(AbstractQueryImpl.java:448)
at org.hibernate.console.HQLQueryPage.getPathNames(HQLQueryPage.java:72)
at org.hibernate.eclipse.console.views.QueryPageViewer.addColumnsToTable(QueryPageViewer.java:189)
at org.hibernate.eclipse.console.views.QueryPageViewer.createTable(QueryPageViewer.java:164)
at org.hibernate.eclipse.console.views.QueryPageViewer.createControl(QueryPageViewer.java:147)
at org.hibernate.eclipse.console.views.QueryPageViewer.<init>(QueryPageViewer.java:105)
at org.hibernate.eclipse.console.views.QueryPageTabView.rebuild(QueryPageTabView.java:78)
at org.hibernate.eclipse.console.views.QueryPageTabView$1.contentsChanged(QueryPageTabView.java:47)
at org.hibernate.eclipse.console.views.QueryPageTabView$1.intervalAdded(QueryPageTabView.java:52)
at javax.swing.AbstractListModel.fireIntervalAdded(Unknown Source)
at org.hibernate.console.QueryPageModel.add(QueryPageModel.java:50)
at org.hibernate.console.KnownConfigurations$3.queryPageCreated(KnownConfigurations.java:167)
at org.hibernate.console.ConsoleConfiguration.fireQueryPageCreated(ConsoleConfiguration.java:265)
at org.hibernate.console.ConsoleConfiguration.executeHQLQuery(ConsoleConfiguration.java:246)
at org.hibernate.eclipse.console.actions.ExecuteHQLAction.execute(ExecuteHQLAction.java:99)
at org.hibernate.eclipse.console.actions.ExecuteHQLAction.run(ExecuteHQLAction.java:94)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:996)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:538)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:441)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:842)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2894)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2527)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1570)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1534)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:306)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:228)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:156)
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.core.launcher.Main.invokeFramework(Main.java:315)
at org.eclipse.core.launcher.Main.basicRun(Main.java:268)
at org.eclipse.core.launcher.Main.run(Main.java:942)
at org.eclipse.core.launcher.Main.main(Main.java:926)
Name and version of the database you are using:Oracle9i
Hi all! I'm using hibernate-tools3-alpha1 with eclipse3.1m6. In hibernate console perspective I have created configuration and trying to perform some queries against my datasource.
Operatio and Specific are in one-to-many biderectional relationship(one operatio to many specific).
queries like
Code:
from Operatio as op where op.cod=....
and like
Code:
select sp.operatio from Specific as sp where sp.cod=...
work fine. But when I'm trying to execute query like this one
Code:
select op.specific from Operatio as op where op.cod=...
exception occured[/code]