Collection result = new ArrayList();
Transaction tx = null;
try {
Session session = HibernateUtil.currentSession();
tx = session.beginTransaction();
Query query = session.createQuery(sql);
result = query.list();
tx.commit();
} catch (Exception e) {
throw e;
} finally {
HibernateUtil.closeSession();
}
ArrayList sList = (ArrayList) result;
Iterator iterator1 = sList.iterator();
while (iterator1.hasNext()) {
Object[] o = (Object[]) iterator1.next();
tBookInfo bookInfo = (tBookInfo) o[0];
BookSelection bookSelect = (BookSelection) o[1];
System.out.println("BookInfo-Title: " + bookInfo.getTitle());
System.out.println("BookSelection-BookSelectionId: " + bookSelect.getId());