1
I need to create an HQL query within a method in C#. The structure goes like this: I have the method:
IList<int>GetListYear(Guid educationalInstitutionId, Guid academicLevelId, Guid? locationId, Guid? programOfferedId)
{
//Implementar a consulta HQL
}
And I have my HQL appointment:
"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"
How can I assemble this structure to join the HQL query with the parameters I received from my method?
Hello @Thiagofalcão. I tried to use
Query query = Session.CreateHqlQuery(hql.ToString());
but does not recognize and asks to make the reference. I made the reference withNHibernate.Engine
, which was suggested but did not work.– Igor Macedo
right, try to change the part that creates the query to this: Query query = Session.createQuery(hql.Tostring()); if something is incorrect, try to put the first uppercase letter of Session and createQuery. the reference site is out of stock :( https://docs.jboss.org/hibernate/orm/3.3/reference/pt-BR/html/queryhql.html
– Thiago Friedman
It didn’t work @Thiagofalcão. He doesn’t recognize the class
Query
.– Igor Macedo