-->
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 with a reference of the same type?
PostPosted: Thu Mar 03, 2011 12:45 pm 
Newbie

Joined: Thu Mar 03, 2011 10:15 am
Posts: 1
Hello, i want to map a class with a reference of the same type,
like this:

Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
               assembly="CircularTest"
               namespace="CircularTest">

  <class name ="A" table ="ATable">

    <!-- Id -->
    <id name ="Id" type ="Guid">
      <generator class ="guid.comb"/>
    </id>

    <!-- Data -->
    <property name ="Data"/>

    <!-- Areference -->
    <property name ="Areference" />

  </class>

</hibernate-mapping>

Code:
namespace CircularTest
{
    public class A
    {
        public virtual Guid Id { get; set; }
        public virtual int Data { get; set; }
        public virtual A Areference { get; set; }
    }
}


and got the following exception:

Could not determine type for: CircularTest.A, CircularTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b742abd039f7ea9e, for columns: NHibernate.Mapping.Column(Areference)

How can I map this kind of relation?.

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.