Hi,
I have worked out a piece of code. But I'm not 100% sure if this is the way to do it. But it works....
I have a class parameter that contains a collection of parameterdetails. And I want to update on of the parameterdetails, out of the collection.
long pk = 50;
Parameter parameter = new Parameter();
session.load(parameter,new Long(pk));
Collection query = getSession().filter(parameter.getParameterDetails(),"where this.id = "+ parameterForm.getId());
if(!query.isEmpty()){ //I'm 1000% sure that the object exists, but I couldn't remove the if, bad feelings....
Parameterdetail parameterDetail = (Parameterdetail)query.iterator().next();
ParameterdetailLogic.setData( parameterDetail,
parameterForm.getOmschrijvingNL(),
parameterForm.getOmschrijvingFR(),
parameterForm.getOmschrijvingEN(),
parameterForm.getOmschrijvingDE());
getSession().saveOrUpdate(parameterDetail);
}
Thx in advance,
Pieter
|