question one
for example , i have 100 records, every page show 10 records
Code:
q=session.createQuery(hql);
q.setFirstResult(firstResult);
q.setMaxResults(10);
the code only get the record and record number on every page,how to get all record's number
if i need
Code:
q=session.createQuery(hql);
run the code again to get the total record number?
question twoi set lazy=true, for example , i load the parent on one session,but in another session,i need use
Code:
parent.getchilds().add(child)
to add a child, it will throw error, so i have to in first session to load every parent's child
now in first session,i use code
Code:
for(Iteator ite=parent.getchild().iterator;ite.hasnext()){
ch=(child)ite.next();
}
i don't know whether have other ways or not.
please give me some advice on it! thanks