Hi.
Gostaria de saber se é possivel remover um objeto dessa maneira:
public class TimesheetMBean{
@EJB
private TimesheetFacade timesheetFacade;
public void deleteTimesheet(){
Timesheet timesheet = new Timesheet();
timesheet.setPkTimesheet(pkTimesheetSelected);
timesheetFacade.remove(timesheet);
}
}
//Método no repositorio usado pelo façade
protected EntityManager em;
public void remove(T entity){
em.remove(entity);
}
O erro que acontrece é o seguinte:
Caused by: java.lang.IllegalArgumentException: Removing a detached instance org.iprogramming.model.entity.Timesheet#4
at org.hibernate.ejb.event.EJB3DeleteEventListener.performDetachedEntityDeletionCheck(EJB3DeleteEventListener.java:45)
Alguem pode me ajudar ?