From: Juergen H. <jho...@us...> - 2006-08-07 21:25:42
|
Update of /cvsroot/springframework/spring/tiger/src/org/springframework/orm/jpa In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv31592/tiger/src/org/springframework/orm/jpa Modified Files: AbstractEntityManagerFactoryBean.java EntityManagerFactoryInfo.java Log Message: EntityManagerFactoryInfo interface does not extend PersistenceExceptionTranslator anymore (only JpaDialect does) Index: EntityManagerFactoryInfo.java =================================================================== RCS file: /cvsroot/springframework/spring/tiger/src/org/springframework/orm/jpa/EntityManagerFactoryInfo.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** EntityManagerFactoryInfo.java 14 Jun 2006 12:55:50 -0000 1.6 --- EntityManagerFactoryInfo.java 7 Aug 2006 21:25:39 -0000 1.7 *************** *** 33,37 **** * @since 2.0 */ ! public interface EntityManagerFactoryInfo extends PersistenceExceptionTranslator { /** --- 33,37 ---- * @since 2.0 */ ! public interface EntityManagerFactoryInfo { /** Index: AbstractEntityManagerFactoryBean.java =================================================================== RCS file: /cvsroot/springframework/spring/tiger/src/org/springframework/orm/jpa/AbstractEntityManagerFactoryBean.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** AbstractEntityManagerFactoryBean.java 3 Jul 2006 16:57:54 -0000 1.13 --- AbstractEntityManagerFactoryBean.java 7 Aug 2006 21:25:39 -0000 1.14 *************** *** 40,43 **** --- 40,44 ---- import org.springframework.beans.factory.InitializingBean; import org.springframework.dao.DataAccessException; + import org.springframework.dao.support.PersistenceExceptionTranslator; import org.springframework.util.ClassUtils; import org.springframework.util.CollectionUtils; *************** *** 61,65 **** */ public abstract class AbstractEntityManagerFactoryBean ! implements FactoryBean, InitializingBean, DisposableBean, EntityManagerFactoryInfo { protected final Log logger = LogFactory.getLog(getClass()); --- 62,67 ---- */ public abstract class AbstractEntityManagerFactoryBean ! implements FactoryBean, InitializingBean, DisposableBean, ! EntityManagerFactoryInfo, PersistenceExceptionTranslator { protected final Log logger = LogFactory.getLog(getClass()); *************** *** 195,210 **** } - /** - * Use the dialect's conversion if possible: otherwise fall back - * to generic excepton conversion. - * @see JpaDialect#translateExceptionIfPossible - * @see EntityManagerFactoryUtils#convertJpaAccessExceptionIfPossible - */ - public DataAccessException translateExceptionIfPossible(RuntimeException ex) { - return (this.jpaDialect != null ? - this.jpaDialect.translateExceptionIfPossible(ex) : - EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(ex)); - } - public final void afterPropertiesSet() throws PersistenceException { --- 197,200 ---- *************** *** 277,280 **** --- 267,285 ---- + /** + * 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. + * @see org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor + * @see JpaDialect#translateExceptionIfPossible + * @see EntityManagerFactoryUtils#convertJpaAccessExceptionIfPossible + */ + public DataAccessException translateExceptionIfPossible(RuntimeException ex) { + return (this.jpaDialect != null ? + this.jpaDialect.translateExceptionIfPossible(ex) : + EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(ex)); + } + public EntityManagerFactory getNativeEntityManagerFactory() { return this.nativeEntityManagerFactory; |