-->
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.  [ 4 posts ] 
Author Message
 Post subject: the HQL statement,why errors occured?
PostPosted: Tue Aug 31, 2004 10:33 pm 
Newbie

Joined: Tue Aug 31, 2004 10:12 pm
Posts: 4
below is the mapping file and HQL statement

ChargeRecord.hbm.xml

<hibernate-mapping>
<class name="com.company.app.db.ChargeRecord" table="CHARGE_RECORD" dynamic-update="false"
dynamic-insert="false" >

<id name="id" type="java.lang.Integer" >
<column name="ID" sql-type="INTEGER" />
<generator class="sequence"> </generator>
</id>

<discriminator column="class" type="string" />

<property name="chargeDate" type="java.util.Date" update="true" insert="true" access="property" >
<column name="CHARGE_DATE" sql-type="DATE" />
</property>

<property name="amount" type="java.lang.Double" update="true" insert="true" access="property" >
<column name="AMOUNT sql-type="DOUBLE" />
</property>

<many-to-one name="chargetype" class="com.company.app.db.ChargeType" cascade="none"
outer-join="auto" update="true" insert="true" access="property" column="CHARGETYPE_FK"
/>

<subclass name="com.company.app.db.ChargeRecordImpl" dynamic-update="false"
dynamic-insert="false" discriminator-value="ChargeRecordImpl"
>
</subclass>
</class>
</hibernate-mapping>



ChargeType.hbm.xml

<hibernate-mapping>
<class name="com.company.app.db.ChargeType" table="CHARGE_TYPE" dynamic-update="false" dynamic-insert="false"
>

<id name="id" type="java.lang.Integer" >
<column name="ID" sql-type="INTEGER" />
<generator class="uuid.hex">
</generator>
</id>

<discriminator column="class" type="string" />

<property name="chargetype" type="java.lang.String" update="true" insert="true" access="property" >
<column name="CHARGETYPE" sql-type="VARCHAR(255)" />
</property>

<property name="amount" type="java.lang.Double" update="true" insert="true" access="property" >
<column name="AMOUNT" sql-type="DOUBLE" />
</property>

<subclass name="com.company.app.db.ChargeTypeImpl" dynamic-update="false" dynamic-insert="false" discriminator-value="ChargeTypeImpl" >
</subclass>

</class>

</hibernate-mapping>


the HQL statement :

select chargeType.chargetype,sum(chargeRecord.amount) from ChargeRecord as chargeRecord
join ChargeType as chargeType where 1=1
group by chargeType.chargetype


and the error message:

net.sf.hibernate.QueryException:
outer or full join must be followed by path expression
[select chargeType.chargetype,sum(chargeRecord.amount) from
com.company.app.db.ChargeRecord as chargeRecord
join ChargeType as chargeType where 1=1 group by chargeType.chargetype ]


how to solve this kind of problems?thank u all!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 01, 2004 6:20 am 
Regular
Regular

Joined: Wed Aug 18, 2004 5:16 am
Posts: 69
Location: Modena, Italy
Read documentation and the examples about joins at http://www.hibernate.org/hib_docs/refer ... yhql-joins


Top
 Profile  
 
 Post subject: to Teg :
PostPosted: Wed Sep 01, 2004 11:31 pm 
Newbie

Joined: Tue Aug 31, 2004 10:12 pm
Posts: 4
is there any mistake in my HQL statement,i can not solve the problem,thank u!


Top
 Profile  
 
 Post subject: i god it!
PostPosted: Wed Sep 01, 2004 11:34 pm 
Newbie

Joined: Tue Aug 31, 2004 10:12 pm
Posts: 4
ok,i god it,thank u Teg!


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

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.