-->
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.  [ 5 posts ] 
Author Message
 Post subject: org.hibernate.PropertyNotFoundException: field not found
PostPosted: Fri Feb 22, 2008 8:04 am 
Beginner
Beginner

Joined: Wed May 16, 2007 7:12 am
Posts: 41
Location: London
<property name="lookup.lookupCode" column="COMPONENT" />

can we do this in hibernate 3.0?
I get an error org.hibernate.PropertyNotFoundException: field not found: lookup.lookupCode

I have a object lookup in the java class, with an attribute lookupCode.

_________________
Dinesh Mahadevan

Visit me at http://www.yelani.com/


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 22, 2008 9:27 am 
Beginner
Beginner

Joined: Fri May 18, 2007 10:28 am
Posts: 48
Location: Madison, WI
Can you post your hbm file??

_________________
Please rate if it helped


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 22, 2008 9:47 am 
Beginner
Beginner

Joined: Wed May 16, 2007 7:12 am
Posts: 41
Location: London
satsranchuser wrote:
Can you post your hbm file??

It is all pretty standard.. I am not sure what u're looking for

Code:
<hibernate-mapping>

   <class table="TABLE" name="com.Test">

      <cache usage="read-only" />

      <id column="ID" name="id">
         <generator class="native" />
      </id>
<property name="lookup.lookupCode" column="LOOKUP" />
</class>
</hibernate-mapping>

JAVA Class

private Lookup lookup; // Contains String lookupCode


_________________
Dinesh Mahadevan

Visit me at http://www.yelani.com/


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 22, 2008 11:43 am 
Senior
Senior

Joined: Fri Jun 01, 2007 12:41 pm
Posts: 121
For your object 'lookup' with attribute 'lookupCode', you should use many-to-one association instead of property.

Code:
<property name="lookup.lookupCode" column="LOOKUP" />


many-to-one mapping is:

Code:
<many-to-one name="lookup" not-null="true">


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 22, 2008 1:43 pm 
Beginner
Beginner

Joined: Wed May 16, 2007 7:12 am
Posts: 41
Location: London
Agreed, if you are trying to load the complete object...However, I only get the lookup code returned from a procedure.

I am looking to load only one attribute(lookupCode) in the object(lookup) from a name SQL query.

_________________
Dinesh Mahadevan

Visit me at http://www.yelani.com/


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