-->
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.  [ 3 posts ] 
Author Message
 Post subject: net.sf.hibernate.QueryException: in expected
PostPosted: Thu May 19, 2005 1:55 pm 
Regular
Regular

Joined: Fri Jan 28, 2005 3:11 am
Posts: 81
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
2.8

Mapping documents:
<hibernate-mapping package="com.talisen.lbwebpo.model">

<class name="RfqData" table="RFQ_DATA">
<id name="rfqDataId" column="RFQ_DATA_ID" type="integer">
<generator class="native"/>
</id>

<property name="supplierCode" column="SUPPLIER_CODE" type="string" />
<property name="dateGenerated" column="DATE_GENERATED" type="date" not-null="true" />
<property name="extension" column="EXTENSION" type="string" not-null="true" />
<property name="status" column="STATUS" type="string" not-null="true" />
<property name="type" column="TYPE" type="string" not-null="true" />
<property name="username" column="USERNAME" type="string" not-null="true" />
<property name="requested" column="REQUESTED" type="date" />
<property name="returned" column="RETURNED" type="date" />
<property name="filename" column="FILENAME" type="string" />

<many-to-one name="po" column="PARENT_PO_ID" class="Po" not-null="true" />
</class>

</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
count = (Integer) session
.createQuery(
"select count(*) from RfqData rd where rd.parentPoId = "
+ parentPoId + " and rd.returned is null").uniqueResult();
tx.commit();
Full stack trace of any exception that occurs:
javax.servlet.ServletException: net.sf.hibernate.QueryException: in expected: rd [select count(*) from RfqData rd where rd.parentPoId = 2345011 and rd.returned is null]
Name and version of the database you are using:
Oracle 9i
The generated SQL (show_sql=true):
None. It can't parse out the HQL. See above.


Top
 Profile  
 
 Post subject: Re: net.sf.hibernate.QueryException: in expected
PostPosted: Thu May 19, 2005 1:59 pm 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
aturetsky wrote:
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
2.8

Mapping documents:
<hibernate-mapping package="com.talisen.lbwebpo.model">

<class name="RfqData" table="RFQ_DATA">
<id name="rfqDataId" column="RFQ_DATA_ID" type="integer">
<generator class="native"/>
</id>

<property name="supplierCode" column="SUPPLIER_CODE" type="string" />
<property name="dateGenerated" column="DATE_GENERATED" type="date" not-null="true" />
<property name="extension" column="EXTENSION" type="string" not-null="true" />
<property name="status" column="STATUS" type="string" not-null="true" />
<property name="type" column="TYPE" type="string" not-null="true" />
<property name="username" column="USERNAME" type="string" not-null="true" />
<property name="requested" column="REQUESTED" type="date" />
<property name="returned" column="RETURNED" type="date" />
<property name="filename" column="FILENAME" type="string" />

<many-to-one name="po" column="PARENT_PO_ID" class="Po" not-null="true" />
</class>

</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
count = (Integer) session
.createQuery(
"select count(*) from RfqData rd where rd.parentPoId = "
+ parentPoId + " and rd.returned is null").uniqueResult();
tx.commit();
Full stack trace of any exception that occurs:
javax.servlet.ServletException: net.sf.hibernate.QueryException: in expected: rd [select count(*) from RfqData rd where rd.parentPoId = 2345011 and rd.returned is null]
Name and version of the database you are using:
Oracle 9i
The generated SQL (show_sql=true):
None. It can't parse out the HQL. See above.


I don't see a property in RfqData named parentPoId. rd.parentPoId assumes that this property exists. Since you have the <many-to-one> mapping to PO, you need to access the property within that object. For example - "where rd.po.parentPoId = 2345011"


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 19, 2005 2:07 pm 
Regular
Regular

Joined: Fri Jan 28, 2005 3:11 am
Posts: 81
Thanks, that makes a lot of sense. Except, of course, my field will be called

rd.po.poId, since that's what it's called in the Po class.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.