-->
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.  [ 2 posts ] 
Author Message
 Post subject: Recursive Association
PostPosted: Tue Sep 18, 2007 7:36 am 
Newbie

Joined: Tue Sep 18, 2007 5:19 am
Posts: 6
Hi there,
i gut a little problem while setting up my hibernate mapping.

i got a "user" class which should have the attribute:
* String prename
* String lastname
* User replacementperson

so this class is a recurisve one.

everythink works fine - but not the recursive assosication.
all other properties work fine.

has anyone a solution what is wrong at this mapping?

thx in advance,
lars


my User.java

Code:
package eu.***.mappings;

public class User {

   private int userid;
   private String prename;
   private String lastname;
   private User replacementperson;

   public String getPrename() {
      return prename;
   }
   public void setLastname(String nachname) {
      this.lastname = nachname;
   }
   public String getPrename() {
      return prename;
   }
   public void setPrename(String vorname) {
      this.prename = vorname;
   }
   
      public User getReplacementperson() {
      return replacementperson;
   }
   public void setReplacementperson(String replace) {
      this.replacementperson = replace;
   }

   public int getUserid() {
      return userid;
   }
   public void setUserid(int userid) {
      this.userid = userid;
   }

}




my user.hbm.xml:

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
  "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
  "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>

  <class name="eu.***.mappings.User" table="user">

    <id name="userid" column="userid" type="java.lang.Integer">
        <generator class="native"/>
    </id>

    <property name="prename" column="prename" />
    <property name="lastname" column="lastname" />
   
<one-to-one name="replacementperson" class="eu.***.mappings.User"/>

  </class>

</hibernate-mapping>



Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 19, 2007 3:58 am 
Newbie

Joined: Tue Sep 18, 2007 5:19 am
Posts: 6
nobody got an idea? i'm really stuck in this .. please help!


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