1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| public static void main(String[] arguments)
{
Session hibernateSession = null;
Transaction tx = null;
List bddCategoryList1 = new ArrayList();
List bddCategoryList2 = new ArrayList();
try
{
hibernateSession = HibernateUtil.getCurrentSession();
tx =hibernateSession.beginTransaction();
bddCategoryList1=Category.findAll(hibernateSession);
for(int i = 0; i < bddCategoryList1.size(); i++){
bddCategoryList2=Logo.findByCategory(hibernateSession,((Category)bddCategoryList1.get(i)));
System.out.println(((Category)bddCategoryList1.get(i)).getName());
for(int j = 0; j < bddCategoryList2.size(); j++){
System.out.println(((Logo)bddCategoryList2.get(j)).getBskName());
}
}
tx.commit();
}
catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
tx.rollback();
}
}
} |
Partager