-->
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: Loading values though fields instead of properties
PostPosted: Tue Mar 13, 2007 9:26 pm 
Newbie

Joined: Tue Mar 13, 2007 9:00 pm
Posts: 5
Hi,

I've just been assigned to a new project at work and I've got couple fo quick questions on NHibernate:

1) Is it at all possible to load the data though private field variables instead of using properties?

2) Is it possible to map the following:
[SQL] I've got 3 tables: Document(ID,Name....) DocumentTable(ID,Name...) DocumentField(ID,Name ...) and a table that combines all of these together DocumentComposition(DocumentID,TableID,FieldID)

[C#] Document { int ID, List<Table> tables ..... }, Table { int ID, List<Field> fields ...} , Field { int ID, string Name .....}

Thanks in advance,
Nick Goloborodko


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 14, 2007 3:19 am 
Senior
Senior

Joined: Mon Aug 21, 2006 9:18 am
Posts: 179
#1:

Use access="field" to instruct NHib to work with your fields. If you have a naming strategy other than :
Code:
private int camelCase;


Then you can append the access strategy like access="field.camelcase-underscore" name="MyField".

#2:

You'll want to use IList<type> for your collections. Just use a one-to-many relationship from Document-Table and Table-Field..here's in Document mapping...
Code:
<bag name="tables" access="field.camelcase">
      <key column="DocumentId" foreign-key="Document_Table"/>
      <one-to-many class="DocumentTable" />
</bag>



Hope this helps...

_________________
If this helped...please remember to rate it!


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.