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: criteria select with outer join
PostPosted: Thu Dec 03, 2009 2:22 pm 
Newbie

Joined: Thu Dec 03, 2009 2:10 pm
Posts: 13
Hello,
I am currently trying to query a table which has a many-to-one relationship with another table. consider the following sales - orders example. I am trying to get all orders associated with a particular saleID. I have tried using the following -

Code:

public IList<order> getOrderBySalesId(int salesId)
{
     return _session.CreateCriteria(typeof(sales))
          .Add(Expression.Eq("salesId", salesId))
          .SetFetchMode("order", FetchMode.Eager)
          .List();
}


However, I am getting the following error -

"The value \"sales\" is not of type \"order\" and cannot be used in this generic collection

Can anybody tell me what I might be doing wrong?

Thanks for any thoughts.


Top
 Profile  
 
 Post subject: Re: criteria select with outer join
PostPosted: Wed Dec 09, 2009 2:33 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Your query returns IList<sales> not IList<order> ! Can u post the mappings ?

_________________
--Wolfgang


Top
 Profile  
 
 Post subject: Re: criteria select with outer join
PostPosted: Wed Dec 09, 2009 4:22 am 
Newbie

Joined: Mon Nov 30, 2009 10:13 pm
Posts: 5
can u show us ur mappings?

_________________
links of london
ugg boots
wow gold


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.