Hello I have been studing the tutorial at
http://http://www.netbeans.org/kb/61/web/hibernate-vwp.html
I am starting to understand how data from a database gets to a webpage to a table via a selection box. But in the code I can not see where it actually build a SQL query
is there a method in one of these blocks of code that would build a query to extract all the data from the db based on a the item selected in a drop down list?
private void buildPersonOptions() {
List<Person> personList = null;
try {
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
Transaction tx = session.beginTransaction();
Query q = session.createQuery("from Person");
personList = (List<Person>) q.list();
} catch (Exception e) {
e.printStackTrace();
}
personOptions = new Option[personList.size()];
int i = 0;
for (Person person : personList) {
Option opt = new Option(person.getPersonId(), person.getName());
personOptions[i++] = opt;
}
}