emmanuel wrote:
there is a bug in your code. But you don't show it... Try to simplify your pb in a simple testcase
UserActivity object has one-to-many relationship with Activity object (children)....
This are the steps I did in saving my UserActivity method:
1) removeMarkDeletedActivity(userActivity);
2) dao.saveUserActivity(userActivity); // save my
3) return this.getUserActivity(userActivity.getUserActivityId()); // retrieve the object again here....
inside removeMarkDeletedActivity():
List list = new ArrayList();
ActivityVO[] activity = userActivity.getDailyActivities();
for (int i=0; i < activity.length; i++)
{
if (activity[i] != null && activity[i].isMarkDeleted())
{
list.add(activity[i]);
activity[i] = null;
}
}
// Delete activities
dao.removeUserActivityChild(list); //<-- this will delete activity object
--------- end of my removeMarkDeletedActivity() ------
Should I recreate my array before saving instead of leaving it blank?
Thanks for your reply emmanuel :)