-->
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.  [ 3 posts ] 
Author Message
 Post subject: Mapping a nested class?
PostPosted: Fri Nov 11, 2005 1:10 pm 
Beginner
Beginner

Joined: Thu May 26, 2005 1:00 pm
Posts: 29
Is it possible to map a nested class? For example:
Code:
public class A {
  int aId;
  IList log;
  //...
  public class B {
    int bId;
    //...
  }
}
---
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" default-access="field">
   <class name="A, SpringAir.Objects" table="A">
      <!-- ... standard A defs ... -->
      <bag name="log" lazy="true" cascade="all" table="B">
         <key column="BId" />
         <composite-element class="A.B, SpringAir.Objects">
            <!-- B defs -->
         </composite-element>
      </bag>
   </class>
</hibernate-mapping>

When I try this I receive:
Code:
System.TypeLoadException: Could not load type A.B from assembly SpringAir.Objects

Is this not possible in NHibernate, or am I just missing something?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 12, 2005 7:02 am 
Contributor
Contributor

Joined: Thu May 12, 2005 9:45 am
Posts: 593
Location: nhibernate.org
IIRC, in .NET class naming convention, nested class are written with "+"...

So you should write A+B (not A.B).

_________________
Pierre Henri Kuaté.
Get NHibernate in Action Now!


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 13, 2005 4:52 am 
Contributor
Contributor

Joined: Thu May 12, 2005 8:45 am
Posts: 226
Perhaps the class namespace is missing in the mapping?
naasking wrote:
<class name="A, SpringAir.Objects" table="A">

perhaps should be
Code:
<class name="SpringAir.Objects.A, SpringAir.Objects" table="A">


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