-->
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: How to map a class containing the same class ?
PostPosted: Mon Jun 22, 2009 5:58 am 
Newbie

Joined: Mon Jun 22, 2009 5:51 am
Posts: 1
Hello,

I'm trying to map a class which can be composed of element of the same class. Let's consider this class :

Code:
class Element {
private int id;
private Element fatherElement;

// get/set...
}


Here's my current mapping :

Code:
<class name="Element" table="element_table">
   <id name="id" column="id_element">
      <generator class="increment"/>
   </id>
   <many-to-one name="fatherElement" column="id_father_element" class="Element"/>
</class>


The is problrem is as follow : when I try to query on Element.fatherElement.id, an exception is throwed : "could not resolve property: id".

Is there something I'm doing wrong ? I'm not used to Hibernate.

Thanks.


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.