-->
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: Basic Question - My First Experience
PostPosted: Thu Sep 13, 2007 4:12 pm 
Newbie

Joined: Thu Sep 13, 2007 4:00 pm
Posts: 11
Hi all,
This is my first experience with Hibernate and I'm reading my first tutorials. My Problem is simple:

"Products" has a "many-to-one" relationship with "Categories" but when I list "Products", I'm getting a "categoryID". How can I replace the "categoryID" by the "categoryName"? I need to display it in a DataGrid.

My Listing code (works perfectly but does not show category name)
ICriteria _criteria = Session.CreateCriteria(typeof(Products),"Products");
ProductsCollection _list = new ProductsCollection(this);
pCriteria.List(_list);

_________________
André Rodrigues Pena


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 14, 2007 9:42 am 
Beginner
Beginner

Joined: Thu Nov 02, 2006 9:38 am
Posts: 32
Location: Belgium
Are you sure the relationship maps to the product object, and not just the product id?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 15, 2007 9:54 pm 
Newbie

Joined: Wed Jun 21, 2006 2:25 pm
Posts: 15
can you show the hibernate mappings which you are using. I suspect that you are failling into the most common OO trap and trying to set up relationships using IDs rather than thinking in terms of objects

Thanks
anand raman


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.