-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Using tables in Queries
PostPosted: Thu Mar 09, 2006 1:10 pm 
Newbie

Joined: Mon Nov 21, 2005 1:02 pm
Posts: 5
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.