-->
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.  [ 4 posts ] 
Author Message
 Post subject: Mapping a sub property of a C# property
PostPosted: Tue Apr 07, 2009 6:33 am 
Newbie

Joined: Fri Apr 03, 2009 9:40 am
Posts: 10
Things are going well with my NHibernate project. BUT I have hit a problem.


I have a C# class called Person, which is mapped to a SQL table called Person.



However, the Person C# class has a property called Title (of type Title) as shown below –



public class Title

{

public virtual string Value { get; set; }

public virtual string Description { get; set; }

}



– What I want to do in my mapping is something like –



<property name="Title.Value" column="TitleValue" type="String"/>





If I try this, NHibernate literally attempts to look for a property called Title.Value (rather than the property Value of the Title property) e.g. Could not find a getter for property 'Title.Value'



Is there a way around this? So far the only solution I have come up with is an Interceptor and that seems like overkill!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 07, 2009 6:57 am 
Regular
Regular

Joined: Wed Feb 11, 2009 10:58 am
Posts: 55
I think what you need is a component:

http://www.nhforge.org/doc/nh/en/index.html#mapping-declaration-component


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 07, 2009 7:24 am 
Newbie

Joined: Fri Apr 03, 2009 9:40 am
Posts: 10
reflection wrote:


I think you are right! Thank you ever so much. That has made my day ;-)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 07, 2009 7:37 am 
Regular
Regular

Joined: Wed Feb 11, 2009 10:58 am
Posts: 55
you're welcome =)


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