if (item.getId() > 0) {
editMode = true;
}
BoundCompoundPropertyModel model = null;
if (editMode) {
/*
* This ensures that the model object is re-loaded as part
* of the form submission workflow before form binding and
* avoids hibernate lazy loading issues during the whole
* update transaction.
*/
LoadableDetachableModel itemModel = new LoadableDetachableModel() {
protected Object load() {
logger.debug("attaching existing item " + item.getId());
return getJtrac().loadItem(item.getId());
}
};
model = new BoundCompoundPropertyModel(itemModel);
} else {
model = new BoundCompoundPropertyModel(item);
}
setModel(model);
/*
* ===================================================