How do I catch the constraint violation exception from EclipseLink?
I am using EclipseLink in my web application, and I am having a hard time gracefully catching and handling Exceptions it generates. I see from this thread what seems to be a similar problem, but I don't see how to work around or fix it. My code looks like this: public void persist(Category category) { try { utx.begin(); em.persist(category); utx.commit(); } catch (RollbackException ex) { // Log something } catch (HeuristicMixedException ex) { // Log something } catch (HeuristicRollbackException ex) { // Log something } catch (SecurityException ex) { // Log something } catch