-->
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: Error in HQL Querybuilder
PostPosted: Fri Mar 10, 2006 7:35 am 
Newbie

Joined: Mon Nov 21, 2005 1:02 pm
Posts: 5
I will select a n:m mapping with HQL, but HQL didn't create the correct query. The where part in the query isn't generated.
Is there a bug in the query parser?

createQuery(
" select ag from ag in AggregatedFigureBean.class"
+ " where ag.figures = ? ",
new Object[] { figure },
new Type[] { Hibernate.entity(AbstractFigureBean.class) });

The generated query is
select ag.id as id, ... from FIGURE ag, ref_aggregator_aggregated figures0_ where ag.discriminator='AG' and (()

Hibernate version: 2.1.7

Mapping documents:
Code:
   <!-- Figures -->
   <class name="AbstractFigureBean" table="FIGURE" discriminator-value="AF">
      <id name="id" type="long" unsaved-value="-1">
         <generator class="native" />
      </id>
      <discriminator column="discriminator" type="string" length="8"/>
      <version column="version" name="version" type="long"/>
      <many-to-one name="report" column="report_id" class="AbstractReportBean" not-null="true" foreign-key="FK_FIG_REP" index="IDX_FIG_REP" />
      <many-to-one name="organisation" column="organisation_id" class="OrganisationBean" foreign-key="FK_FIG_ORG" index="IDX_FIG_ORG" />
      <many-to-one name="summenzeile" column="summenzeile_id" class="SummenzeileBean" foreign-key="FK_FIG_SUMZ" index="IDX_FIG_SUMZ" />
      <many-to-one name="projekt" column="projekt_id" class="ProjektBean" foreign-key="FK_FIG_PRJ" />
      <property name="frozen" type="boolean" not-null="true" />
      <property name="value" type="double" />
      <property name="kommentar" type="string" length="1000" column="kommentar" />
      <property name="column" column="columnnr" type="integer" />

      <subclass name="CalculatedFigureBean" extends="AbstractFigureBean" discriminator-value="CF">
      </subclass>

      <subclass name="RKZFigureBean" extends="AbstractFigureBean" discriminator-value="RF">
      </subclass>

      <subclass name="SingleFigureBean" extends="AbstractFigureBean" discriminator-value="SF">
      </subclass>

      <subclass name="AggregatedFigureBean" extends="AbstractFigureBean" discriminator-value="AG">
         <list name="figures" batch-size="20" cascade="save-update" 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>
   </class>




The generated SQL (show_sql=true):
Hibernate: select ag.id as id, ... from FIGURE ag, ref_aggregator_aggregated figures0_ where ag.discriminator='AG' and (()
[/code]


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.