Hi,
I'm trying to get a list of universities from my site table. My
current approach is to write a select distinct query in Hibernate, for
the siteParentName attribute; then use that list's size() method to get
the number of elements.
I am getting a null pointer exception when instantiating the query:
public int getNumberUniversitites() {
Query query = null;
List list = null;
try {
query =
session.createQuery("select distinct site.siteParentName from Site");
} catch (HibernateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
list = query.list();
} catch (HibernateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return list.size();
}
thanks,
Jana
.