-->
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: HQL (join and SubQuery )
PostPosted: Tue Oct 26, 2010 1:27 pm 
Newbie

Joined: Sun Sep 26, 2010 2:09 am
Posts: 11
hi
i am working with HQL in Nhibernate (in a C#.net Application )

i tried to implement this query


select distinct Course_Title from Course_Info join CMM_BatchCourse_Map on Fk_Course_Id= Course_Id where Fk_Batch_Id= (select Batch_Id

from CMM_Batch_Info where Batch_Title = 'BSC P1')


(THIS query is correctly in SQL SERVER )


but i tried to implement this in through HQL it gives semantic error


public IList<Course> GetByBatchName(string batchTitle)
{
ICriteria criteria = Session.CreateCriteria<Course>();
Session.CreateQuery("select distinct CourseTitle from Course join CMM_BatchCourse_Map on FkCourseId = CourseId where

Fk_Batch_Id= (select Batch_Id from CMM_Batch_Info where Batch_Title = 'BSC P1')" );
return criteria.List<Course>();
}

can somebody help me ,,HOW TO WRITE THIS QUERY IN HQL ?


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.