hi,
I have following problem with update:
I'm using hibernate with struts in the 3-tier application
My ActionForm(model) contains reference to the persistent object. If I want to edit object's properties, in the reset function is necessary to load (calling the session.load(class, id))appropriate object. Calling the toString() function on the object I saw, that this object was initialized properly. However, if I want to update this object (in Action class), an exception (about null identifier ) is thrown. I called toString() function on the same object (reference is passed in the parameter), but some properties (type date and id) are missing (they are null)!!! Why ???
Following is the simple description of my scenario:
ArtikelBean {
long id;
Date createTime;
Date changeTime;
String description;
//for each property is getter/setter
public void update();
public void save();
public static ArtikelBean getById(Long id);
}
ArtikelForm{
ArtikelBean ab;
public void reset(Long id){ //id is taken from request of course
ab = ArtikelBean.getById(id);
//here, if I call ab.toString(), object seems to be initialized properly
}
}
ArtikelAction{
execute(ActionForm form){
//here, when I call toString() on the same bean, id and properties of //type date are missing
form.getArtikelBean().update()
//exception is throws, because id is null }
}
cane anyone help me please ???
|