Hello,
I have a question regarding the NHIbernate logs.
The student table in my application has a many-to-one relationship with the Program table. As is evident from the HQL query (below) I need all the students from the Student table but the generated SQL has select statements of the Program table too.
Why would it generate the SQL statements for the Program table ? Is it just in the cache or are these actual statements that are going to be executed against the database? Thanks in advance.
NHibernate Log:
2007-05-14 11:42:37,300 [TestRunnerThread] DEBUG NHibernate.Hql.Classic.QueryTranslator [(null)] - HQL:
from SASWebBusiness.Student student where student.State='A'
2007-05-14 11:42:37,300 [TestRunnerThread] DEBUG NHibernate.Hql.Classic.QueryTranslator [(null)] - SQL:
select student0_.stud_Key as stud1_150_, student0_.stud_Alias as stud2_150_, student0_.stud_FirstName as stud3_150_, student0_.stud_MiddleName as stud4_150_, student0_.stud_LastName as stud5_150_, student0_.stud_IRN as stud6_150_, student0_.stud_EMailAddress as stud7_150_, student0_.stud_State as stud8_150_, student0_.stud_Cohort as stud9_150_, student0_.stud_ResearchTitle as stud10_150_, student0_.stud_prog_Key as stud11_150_ from Student student0_ where student0_.stud_State='A' and ((student0_.stud_State='A' ))
And the corresponding SQL for which was this
2007-05-14 11:42:37,300 [TestRunnerThread] DEBUG NHibernate.SQL [(null)] - select student0_.stud_Key as stud1_150_, student0_.stud_Alias as stud2_150_, student0_.stud_FirstName as stud3_150_, student0_.stud_MiddleName as stud4_150_, student0_.stud_LastName as stud5_150_, student0_.stud_IRN as stud6_150_, student0_.stud_EMailAddress as stud7_150_, student0_.stud_State as stud8_150_, student0_.stud_Cohort as stud9_150_, student0_.stud_ResearchTitle as stud10_150_, student0_.stud_prog_Key as stud11_150_ from Student student0_ where student0_.stud_State='A' and ((student0_.stud_State='A' ))
2007-05-14 11:42:39,331 [TestRunnerThread] DEBUG NHibernate.SQL [(null)] - SELECT program0_.prog_Key as prog1_144_0_, program0_.prog_ProgramName as prog2_144_0_, program0_.prog_ProgramVersion as prog3_144_0_ FROM Program program0_ WHERE program0_.prog_Key=@p0; @p0 = '1'
2007-05-14 11:42:39,346 [TestRunnerThread] DEBUG NHibernate.SQL [(null)] - SELECT program0_.prog_Key as prog1_144_0_, program0_.prog_ProgramName as prog2_144_0_, program0_.prog_ProgramVersion as prog3_144_0_ FROM Program program0_ WHERE program0_.prog_Key=@p0; @p0 = '4'
2007-05-14 11:42:39,378 [TestRunnerThread] DEBUG NHibernate.SQL
[(null)] - SELECT program0_.prog_Key as prog1_144_0_, program0_.prog_ProgramName as prog2_144_0_, program0_.prog_ProgramVersion as prog3_144_0_ FROM Program program0_ WHERE program0_.prog_Key=@p0; @p0 = '5'
2007-05-14 11:42:39,456 [TestRunnerThread] DEBUG NHibernate.SQL [(null)] - SELECT program0_.prog_Key as prog1_144_0_, program0_.prog_ProgramName as prog2_144_0_, program0_.prog_ProgramVersion as prog3_144_0_ FROM Program program0_ WHERE program0_.prog_Key=@p0; @p0 = '3'
2007-05-14 11:42:39,471 [TestRunnerThread] DEBUG NHibernate.SQL [(null)] - SELECT program0_.prog_Key as prog1_144_0_, program0_.prog_ProgramName as prog2_144_0_, program0_.prog_ProgramVersion as prog3_144_0_ FROM Program program0_ WHERE program0_.prog_Key=@p0; @p0 = '2'
2007-05-14 11:42:39,706 [TestRunnerThread] DEBUG NHibernate.SQL [(null)] - SELECT program0_.prog_Key as prog1_144_0_, program0_.prog_ProgramName as prog2_144_0_, program0_.prog_ProgramVersion as prog3_144_0_ FROM Program program0_ WHERE program0_.prog_Key=@p0; @p0 = '7'
2007-05-14 11:42:39,831 [TestRunnerThread] DEBUG NHibernate.SQL [(null)] - SELECT program0_.prog_Key as prog1_144_0_, program0_.prog_ProgramName as prog2_144_0_, program0_.prog_ProgramVersion as prog3_144_0_ FROM Program program0_ WHERE program0_.prog_Key=@p0; @p0 = '6'
2007-05-14 11:42:40,596 [TestRunnerThread] DEBUG NHibernate.SQL [(null)] - SELECT program0_.prog_Key as prog1_144_0_, program0_.prog_ProgramName as prog2_144_0_, program0_.prog_ProgramVersion as prog3_144_0_ FROM Program program0_ WHERE program0_.prog_Key=@p0; @p0 = '8'
|