1 Reply Latest reply on Jul 12, 2007 6:09 AM by Pete Muir

    How to Clone EntityHome Object

    Jonathan Shin Newbie

      I'm creating a task module and the requirement is as follow:
      When user completed the task, copy the current task and change the completion date property to null and add to the database. Is there any example that copy the persistent object then add to the database?

       @Override
       public String update()
       {
       if (this.instance.getTaskCompleted().equals("Y")) {
      
       try {
       TitleXiTaskHome titleXiTask = (TitleXiTaskHome) super.clone();
       titleXiTask.instance.setTaskCompleted("N");
       titleXiTask.instance.setCompletedDate(null);
       titleXiTask.persist();
       } catch (CloneNotSupportedException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
       }
       }
       super.update();
       return "success";
       }
      


      I'm getting CloneNotSupportedException error.

      Thanks.