-->
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: Some trouble with Inner Join operator
PostPosted: Mon Jun 04, 2007 8:25 am 
Newbie

Joined: Thu May 31, 2007 4:53 am
Posts: 7
Hello, All.
I use Inner Join operator in my sql query:
Code:
IQuery queryForRolls = session.CreateQuery(string.Format("select RollId from Rolls as RollId inner join RollOnReels on Rolls.Roll_ID = RollOnReels.Roll_ID and RollOnReels.Reel_ID = {0}", ReelId));
rolls = queryForRolls.List();


But some exception is appeared:
NHibernate.QueryException : unexpected token: inner

How can I resolve this problem?
Hibernate version:1.0.2.0


Top
 Profile  
 
 Post subject: Re: Some trouble with Inner Join operator
PostPosted: Mon Jun 04, 2007 8:47 am 
Newbie

Joined: Mon Dec 11, 2006 12:54 am
Posts: 14
debugx wrote:
Hello, All.
I use Inner Join operator in my sql query:
Code:
IQuery queryForRolls = session.CreateQuery(string.Format("select RollId from Rolls as RollId inner join RollOnReels on Rolls.Roll_ID = RollOnReels.Roll_ID and RollOnReels.Reel_ID = {0}", ReelId));
rolls = queryForRolls.List();


But some exception is appeared:
NHibernate.QueryException : unexpected token: inner

How can I resolve this problem?
Hibernate version:1.0.2.0



You can try something lik this :
IQuery queryForRolls = session.CreateQuery(string.Format("select RollId.columName from Rolls as RollId inner join RollOnReels on RollId.Roll_ID = RollOnReels.Roll_ID and RollOnReels.Reel_ID = {0}", ReelId));
rolls = queryForRolls.List();

Since you have already created an alias for Rolls , i.e,RollId , try referring to the column names using this alias..e.g, RollId.columName


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.