List of usage examples for org.springframework.orm.jpa JpaDialect translateExceptionIfPossible
@Nullable DataAccessException translateExceptionIfPossible(RuntimeException ex);
From source file:org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.java
/** * Implementation of the PersistenceExceptionTranslator interface, as * autodetected by Spring's PersistenceExceptionTranslationPostProcessor. * <p>Uses the dialect's conversion if possible; otherwise falls back to * standard JPA exception conversion./* w w w . j a v a2 s. co m*/ * @see org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor * @see JpaDialect#translateExceptionIfPossible * @see EntityManagerFactoryUtils#convertJpaAccessExceptionIfPossible */ @Override @Nullable public DataAccessException translateExceptionIfPossible(RuntimeException ex) { JpaDialect jpaDialect = getJpaDialect(); return (jpaDialect != null ? jpaDialect.translateExceptionIfPossible(ex) : EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(ex)); }