I have a n:m mapping with a mapping table which isn't a class in my model.
<subclass name="AggregatedFigureBean" extends="AbstractFigureBean" discriminator-value="AG">
<list name="figures" table="ref_aggregator_aggregated">
<key column="aggregator_id" foreign-key="FK_AGGFIG_AGGTOR" />
<index column="position" ></index>
<many-to-many class="AbstractFigureBean" column="aggregated_id" outer-join="true" foreign-key="FK_AGGFIG_AGGTED" />
</list>
</subclass>
How can I access the reference table in my query string?
I habe tried to write something like
ps.getByQuery(
" select ag from ag in class "
+ AggregatedFigureBean.class
+ " , ref_aggregator_aggregated ref "
+ " where ag.id = ref.aggregator_id "
+ " and ref.aggregated_id = ? ",
new Object[] { figure.getOID()},
new Type[] { Hibernate.LONG });
but I got a syntax exception
Exception bei getByQuery( select ag from ag in class class de.bund.bff.itc.report.figure.AggregatedFigureBean , ref_aggregator_aggregated ref where ag.id = ref.aggregator_id and ref.aggregated_id = ? , [Ljava.lang.Object;@f725a6, [Lnet.sf.hibernate.type.Type;@1c8ee34)
net.sf.hibernate.QueryException: in expected: ref [ select ag from ag in class class de.bund.bff.itc.report.figure.AggregatedFigureBean , ref_aggregator_aggregated ref where ag.id = ref.aggregator_id and ref.aggregated_id = ? ]
Hibernate version: 2.1.7
|