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: How can I make an inner join of two tables?
PostPosted: Mon Feb 11, 2008 5:57 am 
Newbie

Joined: Mon Feb 11, 2008 4:36 am
Posts: 3
Hi,

I only want to make an easy inner join of two tables, but I don't get it work.

Here is the SQL query:

SELECT *
FROM dbo.team INNER JOIN
dbo.statistik ON dbo.team.TeamID = dbo.statistik.TeamID

Table team is mapped in class Team and table statistik in class Statistik.
I tried to get it work with NHibernate, but I always get an error.

HQL:

return session.CreateQuery(@"SELECT * FROM Statistik INNER JOIN Team ON Statistik.TeamID = Team.TeamID").List();

I also tried it with CreateSQLQuery and with CreateCriteria, but it's always the same ... error.

Did somebody has an idea, how I could solve this problem?

regards,
Tribjun


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 11, 2008 7:07 am 
Newbie

Joined: Mon Feb 11, 2008 7:03 am
Posts: 1
You can try using

return session.CreateSQLQueryQuery(@"SELECT * FROM Statistik INNER JOIN Team ON Statistik.TeamID = Team.TeamID").List();

hope this works for you

regards
Selva


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 11, 2008 7:58 am 
Newbie

Joined: Mon Feb 11, 2008 4:36 am
Posts: 3
Hi Selva,

sadly it doesn't work. The following message occurs:

"Return types of SQL query were not specified ..."

That's why I guess it must exist a solution with CreateQuery or with CreateCriteria ... but how?


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.