select multi tables join ---Hibernate

String hql = "from A a,B b, C c where a.id=b.id and b.id =c.id";
List list = dao.getListByHql(hql);
for(int i=0; i<list.size();i++){
	Object[] objectArray = (Object[]) list.get(i);
        A model_a = (A)objectArray[0];
	B model_b = (B)objectArray[1];
	C model_c = (C)objectArray[2];
}

猜你喜欢

转载自roddy.iteye.com/blog/2252962