Hi,
I have the following query: Department and Student have bidirectional
many-to-many association.
Query query = session.createQuery("SELECT d.id, d.name, s.name, elements(d.students) "+
" FROM Department as d, Student as s "+
" WHERE d.id = ? and s.id = ?");
query.setString(1, "01");
query.setString(2, "00001");
List summaryList = query.list();
I got "java.lang.NullPointerException" for the above query. But when I use
the Hibernate generated sql code to run it on the commanline, it gives me
a list of results. I am puzzled at this phenomenon. Does that mean my HQL is correct since generated SQL code produces correct results? But why did it
give me a NullPointerException when I ran it? really need enlihtment on this.
thanks,
|