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.  [ 8 posts ] 
Author Message
 Post subject: Inheritance/Mapping
PostPosted: Sun Aug 19, 2007 10:33 am 
Newbie

Joined: Sun Aug 19, 2007 7:44 am
Posts: 9
Hi All,

i have to classes "Rating" and "TRRating". TRRating extends Rating. The Rating-Class is in one assembly and TRRating in another one.
I use the following mapping files:

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<joined-subclass name="BLL.Stammdaten.BusinessEntities.TRRating, BLL.Stammdaten.BusinessEntities" table="TRRating" extends="BLL.Common.BusinessEntities.Rating, BLL.Common.BusinessEntities">
<key column="RatingID"/>
<property name="Description" column="Description" />
</joined-subclass>
</hibernate-mapping>

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="BLL.Common.BusinessEntities" assembly="BLL.Common.BusinessEntities">
<class name="Rating" table="Rating">
<id name="ID">
<column name="RatingID" sql-type="int32" not-null="true"/>
<generator class="identity" />
</id>
<property name="Transaction" >
<column name="TransactionName" not-null="true" />
</property>
<property name="Tranche" >
<column name="TrancheName" not-null="true" />
</property>
</class>
</hibernate-mapping>

I always get an error message "These classes extend unmapped classes...". If i copy all classes and bm.xml files in one assembly and of course correct the "assembly" attribute in the hbm.xml files all works fine.

How can i separate these classes in two assemblies? Is it possible?

Thanks in advance,
MIke


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 20, 2007 11:30 am 
Expert
Expert

Joined: Fri May 13, 2005 11:13 am
Posts: 292
Location: Rochester, NY
I thought there was a method for adding multiple assemblies in a <hibernate-configuration> section. There is definitely a method for adding named resources there (see here).

You could also configure programmatically, calling NHibernate.Cfg.Configuration.AddAssembly() for each assembly you need to load mappings from.

There is much more flexibility in configuration than the vanilla options that are documented.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 21, 2007 2:47 am 
Newbie

Joined: Sun Aug 19, 2007 7:44 am
Posts: 9
Hi,

thanks for your reply. I tried all as you mentioned but nothing worked. If i seperate the 2 hbm files in diefferent dlls it doesn't work.

Thanks again,
Mike


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 21, 2007 2:48 am 
Newbie

Joined: Sun Aug 19, 2007 7:44 am
Posts: 9


Last edited by merlin008 on Tue Aug 21, 2007 2:53 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 21, 2007 2:49 am 
Newbie

Joined: Sun Aug 19, 2007 7:44 am
Posts: 9


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 21, 2007 2:29 pm 
Expert
Expert

Joined: Fri May 13, 2005 11:13 am
Posts: 292
Location: Rochester, NY
By "it doesn't work," do you mean you're still getting the same "extending unmapped classes" exception? If so, does changing the order that the mappings are added help? Could you post the full output of the exception you are getting and your configuration code?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 21, 2007 3:07 pm 
Newbie

Joined: Sun Aug 12, 2007 2:34 pm
Posts: 8
Location: Geneva, IL USA
Merlin,

Check Hector's sample in this thread on how he gets multiple databases in one domain to work:

http://forum.hibernate.org/viewtopic.php?t=962161

The key is you need to map both your assemblies in the config. I've got this to work successfully for me. The concept will probably solve your inheritance problem.

LH


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 30, 2007 4:07 am 
Newbie

Joined: Sun Aug 19, 2007 7:44 am
Posts: 9
Hi All,

thanks fpr helping me, but i solved it now in a different way. I can't get work in seperate Files (Dlls), so i decided to make one DLL just for hosting the mapping files. This workaround works good for me.

Again, thanks for help.

Bye
Mike


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