Cosa sta succedendo qui?L'entità deve essere gestita per chiamare rimuovere
@Stateless
@LocalBean
public class AppointmentCommentDao {
public void delete(long appointmentCommentId) {
AppointmentComment ac = em.find(AppointmentComment.class, appointmentCommentId);
if (ac != null)
{
em.merge(ac);
em.remove(ac);
}
}
@PersistenceContext
private EntityManager em;
}
Sulla chiamata a remove
ottengo una IllegalArgumentException
con il messaggio di essere Entity must be managed to call remove: ...., try merging the detached and try the remove again.
risolto con il metodo em.find (...). –