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: How do I write XML mapping file for my generic class?
PostPosted: Thu May 22, 2008 8:52 am 
Newbie

Joined: Thu May 22, 2008 5:38 am
Posts: 1
How do I write XML mapping file for my following generic class Ring<T>? The red character in the following XML file always appears error. NHibernate always shows cannot find class Ring.

Could I get some advices?

Thanks.

Hibernate version:
1.2.1

Mapping documents:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="DeAfri.Core.Domain" assembly="DeAfri.Core">
<class name="Ring" table="`tRing`" lazy="false">
<id name="ID" column="`ID`" type="Guid">
<generator class="guid"/>
</id>
<discriminator column="Sex"/>
<subclass name="MaleRing" lazy="false">
<bag name="Diamonds" lazy="false">
<key column="RingID"/>
<one-to-many class="MaleDiamond"/>
</bag>
</subclass>
<subclass name="FemaleRing" lazy="false">
<bag name="Diamonds" lazy="false">
<key column="RingID"/>
<one-to-many class="FemaleDiamond"/>
</bag>
</subclass>
</class>
</hibernate-mapping>

Domain object classes:
public abstract class Diamond { }
public class MaleDiamond : Diamond { }
public class FemaleDiamond : Diamond { }
public abstract class Ring<T> where T : Diamond
{
public IList<T> Diamonds { get; set; }
}
public class MaleRing : Ring<MaleDiamond> { }
public class FemaleRing : Ring<FemaleDiamond> { }


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 27, 2008 8:24 am 
Beginner
Beginner

Joined: Sun Nov 18, 2007 10:39 am
Posts: 46
Location: Liverpool, England
Try changing it to this:

<class name="DeAfri.Core.Domain.Ring, DeAfri.Core" table="`tRing`" lazy="false">


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.