-->
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: Multiple inner joins on NHibernate
PostPosted: Wed Apr 13, 2011 2:39 pm 
Newbie

Joined: Wed Apr 13, 2011 2:25 pm
Posts: 1
Hi,

I'm really new to NHibernate and I'm allocated to a project using Flex, .Net and NHibernate. The custom company framework for NHibernate has a lot of methods and filters, all basic commands to help on developing, but I need to create a more complicated query, joining a lot of tables and returning a list of a non mapped properties, one from each table, result of the query.

I don't know if it's a concept error, considering that I'm not used to OO databases or it's lack of information on internet. I have the SQL query and I don't have any idea on how to execute it. I got some examples using NHibernate inner joins, but they consider only one relationship.




Code:
select rc.CurrentDate, re.ResourceId,re.Name,ro.Description,rc.Cost, sa.Description, rst.Description,sk.Description
from UserRole ur
inner join Role ro on ro.RoleId=ur.RoleID
inner join SystemUser su on su.SystemUserId=ur.SystemUserID
inner join Resource re on re.SystemUserId=su.SystemUserId
inner join ResourceSkill rs on rs.ResourceId=re.ResourceId
inner join Skill sk on sk.SkillId=rs.SkillId
inner join ResourceStatus rst on rst.ResourceStatusId=re.ResourceStatusId
inner join ResourceCost rc on rc.ResourceId=re.ResourceId
inner join SubArea sa on sa.SubAreaId = re.SubAreaId
where rc.CurrentDate=(Select MAX(CurrentDate) from ResourceCost where ResourceId=re.ResourceId)
and ro.RoleId=1 and sk.SkillId=3



Any ideas would be helpful.

Thanks in advance!


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.