-->
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.  [ 1 post ] 
Author Message
 Post subject: [newbie] HOWTO display one-to-many relation in grid
PostPosted: Mon Oct 17, 2005 7:44 am 
Newbie

Joined: Mon Oct 17, 2005 7:13 am
Posts: 1
Location: Poland
Hello, Im quite new to NHibernate.

Im stuck and Im asking for help. I modeled one-to-many relation and result of display differs from what I expected.

There is master table COUNTRY with country name and capital name. There is also a child table named CITY with city name and FK to COUNTRY to assign which city belongs to which country.



Using a query criteria like that:

IList countryList = session.CreateCriteria(typeof(Country)).List();

and bind to standard .NET grid with
this.dataGrid1.DataSource = countryList;


I got it displayed in this way:

Image

Thats some kind different to this what I expected. I rather wanted to have it displayed fully. I mean, if there are f.e. 3 child records in CITIES table assigned to one country I wanted to have 3 records on the grid even if fields country and capital will be doubled. Data is read correctly from, in debug I can see that under this (Collection) lies an object which is correctly filled with data.

I suppose I should change CreateCriteria but the problem is that I didnt find many examples so far.

Do you have any hints how to proceed?[/b]

_________________
DysoN

Image


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.