-->
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: error due to <Many-to-one problem
PostPosted: Thu Mar 12, 2009 2:08 am 
Newbie

Joined: Tue Mar 10, 2009 10:48 pm
Posts: 18
Hi,

I have the following part in my mapping file.

<hibernate-mapping>
<class name="xx" table="xxx" schema="x">

<many-to-one name="yy" class="yyy fetch="select">
<column name="ID" length="32" />

<column name="VERSION" length="10" />
</many-to-one>
</hibernate-mapping>


How do I call the column name (eg ID) in my java code?
Property.forName("ID").eq ...

Error:
could not resolve property

Could someone please help?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 12, 2009 4:18 am 
Senior
Senior

Joined: Wed Sep 19, 2007 9:31 pm
Posts: 191
Location: Khuntien (Indonesia)
could you post your java and the complete stacktrace please?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 12, 2009 5:46 am 
Newbie

Joined: Tue Mar 10, 2009 10:48 pm
Posts: 18
<hibernate-mapping>
<class name="xx" table="xTable" schema="x">
<composite-id name="id" class="xxId">
<key-property name="id" type="string">
<column name="ID" length="32" />
</key-property>

<key-property name="name" type="string">
<column name="NAME" length="7" />
</key-property>
</composite-id>

<many-to-one name="yyy" class="yy" fetch="select">
<column name="SAE_ID" length="32" />

<column name="SAE_VERSION" length="10" />
</many-to-one>


<property name="reportSection" type="string">
<column name="REPORT_SECTION" length="10" />
</property> </class>
</hibernate-mapping>

--------------------------------------
<hibernate-mapping>
<class name="yy" table="yTable" schema="y">
<composite-id name="id" class="yyId">
<key-property name="id" type="string">
<column name="ID" length="32" />
</key-property>

<key-property name="version" type="string">
<column name="VERSION" length="10" />
</key-property>
</composite-id>

<set name="xxes" inverse="true">
<key>
<column name="SAE_ID" length="32" />

<column name="SAE_VERSION" length="10" />
</key>

<one-to-many class="xx" />
</set>


</class>
</hibernate-mapping>


All I need is to get SAE_ID.
But when I do this,
.add( Restrictions.eq("SAE_ID", sId))

Error:
org.hibernate.QueryException: could not resolve property: SAE_ID of: xx


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.