-->
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: Problem with my left join fetch query
PostPosted: Fri Sep 09, 2005 3:29 pm 
Newbie

Joined: Thu Sep 08, 2005 12:15 pm
Posts: 17
Hi ihave this Hql query and i dont know how tio make it work anybody could help me?? Everything is fine unless I put something in the where clause that is referencing on a Class that is left join. e.g : in this case if I dont put t.IdType = 2 it works fine but when its in the query i get an error.


Code:
select count(m) from MediaRadio as m left join fetch m.TypeMedia as t where m.Nom LIKE '%ck%' AND t.IdType = 2


I get this Error

Code:
Column 'typemedi1_.IdTypeMedia' is invalid in the select list because it is not contained in an aggregate function and there is no GROUP BY clause.


thank you
Simon[/quote]


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 10, 2005 9:00 am 
Contributor
Contributor

Joined: Thu May 12, 2005 9:45 am
Posts: 593
Location: nhibernate.org
Try
Code:
select count(m) from MediaRadio as m where m.Nom LIKE '%ck%' AND m.TypeMedia.IdType = 2

_________________
Pierre Henri Kuaté.
Get NHibernate in Action Now!


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 11, 2005 11:55 pm 
Newbie

Joined: Thu Sep 08, 2005 12:15 pm
Posts: 17
Thanks for the reply but i would like to use the left join fetch because TypeMedia as t is a many-to-one relation and i would like the TypeMedia to be retreive in a single sql statement with my MediaRadio. In fact i have a lot more many-to-one relation then that but i simplified the query for the post. What I would like to know is if its possible to have something in the where clause that that is also fetche e.g: the class "t" is mark as fetch and i also have a condition on a field of this class ( t.IdType = 2).

Simon


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.