HQL query in C #

3

Well, I'm having difficulties with HQL and C #. I have the following method:

public IList<int> GetListYear(Guid educationalInstitutionId, Guid academicLevelId, Guid? locationId, Guid? programOfferedId)
{
    //Implementar o HQL
}

And I have the following query:

"select distinct ConclusionYear
from AlumniProgramOffered
inner join AlumniSignup
inner join ProgramOffered*
inner join Program
where AlumniSignup.EducationalInstitution.Identity = educationalInstitutionId
and Program.AcademicLevel.Identity = academicLevelId
and ProgramOffered.Location.Identity = locationId or locationId is null
and ProgramOffered.Identity = programOfferedId or programOfferedId is null"

I need, through HQL, to perform this query by passing the parameters that I receive in my GetListYear method     

asked by anonymous 05.06.2015 / 15:44

1 answer

0

To be sure of how this query would look, you would need the code for all of your entities. But probably your HQL query would look something like this:

select distinct ConclusionYear as cy
from AlumniProgramOffered as apo
 join apo.AlumniSignup as as
 join as.ProgramOffered as po
 join po.Location as loc
 join po.Program as pr
 join pr.AcademicLevel as al
 join pr.EducationalInstitution as edu
where edu.Identity = :educationalInstitutionId
 and al.Identity = :academicLevelId
 and loc.Identity = :locationId or locationId is null
 and po.Identity = :programOfferedId or programOfferedId is null

This, of course, is just the HQL query. The rest of the code for the call of this HQL I'm assuming you already know how to do.

    
19.08.2015 / 00:05