Сущность должна быть в состоянии вызвать удалить

Что тут происходит?

@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;
}

На призыв кremove Я получаюIllegalArgumentException с сообщениемEntity must be managed to call remove: ...., try merging the detached and try the remove again.

Ответы на вопрос(2)

Ваш ответ на вопрос