Exception not cuaght with Entity Manager
问题 I have an Entity Manager in my EJB @PersistenceContext(unitName = "cnsbEntities") private EntityManager em; I populate an object and then I commit it in my DB, but if I have an exception, for duplicate ID, I can't catch it and I don't know why. try{ em.merge(boelLog); } catch (Exception e){ System.out.println("Generic Exception"); } 回答1: JPA uses transactions to send entity modifications to the database. You can specify those transactions manually through Bean Managed Transactions (BMT) or