下面列舉一個完整的例子來說明Hibernate對多個表進行關聯查詢(其中粗體是我們要特別注意的地方
String sTest =
Collection result = new ArrayList();
Transaction tx = null;
try {
Session session = HibernateUtil
tx = session
Query query = session
result = query
mit();
} catch (Exception e) {
throw e;
} finally {
HibernateUtil
}
ArrayList sList = (ArrayList) result;
Iterator iterator
while (iterator
Object[] o = (Object[]) iterator
tBookInfo bookInfo = (tBookInfo) o[
BookSelection bookSelect = (BookSelection) o[
System
System
}
From:http://tw.wingwit.com/Article/program/Java/ky/201311/27865.html