Search in sources :

Example 1 with Iec61850CoreDbApiException

use of com.alliander.osgp.core.db.api.iec61850.exceptions.Iec61850CoreDbApiException in project Protocol-Adapter-IEC61850 by OSGP.

the class Iec61850OsgpCoreDbApiPersistenceConfig method iec61850OsgpCoreDbApiTransactionManager.

/**
     * Method for creating the Transaction Manager.
     *
     * @return JpaTransactionManager
     * @throws ClassNotFoundException
     *             when class not found
     */
@Bean
public JpaTransactionManager iec61850OsgpCoreDbApiTransactionManager() throws Iec61850CoreDbApiException {
    final JpaTransactionManager transactionManager = new JpaTransactionManager();
    try {
        transactionManager.setEntityManagerFactory(this.iec61850OsgpCoreDbApiEntityManagerFactory().getObject());
        transactionManager.setTransactionSynchronization(JpaTransactionManager.SYNCHRONIZATION_ALWAYS);
    } catch (final ClassNotFoundException e) {
        final String msg = "Error in creating transaction manager bean";
        LOGGER.error(msg, e);
        throw new Iec61850CoreDbApiException(msg, e);
    }
    return transactionManager;
}
Also used : Iec61850CoreDbApiException(com.alliander.osgp.core.db.api.iec61850.exceptions.Iec61850CoreDbApiException) JpaTransactionManager(org.springframework.orm.jpa.JpaTransactionManager) Bean(org.springframework.context.annotation.Bean) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)

Aggregations

Iec61850CoreDbApiException (com.alliander.osgp.core.db.api.iec61850.exceptions.Iec61850CoreDbApiException)1 Bean (org.springframework.context.annotation.Bean)1 JpaTransactionManager (org.springframework.orm.jpa.JpaTransactionManager)1 LocalContainerEntityManagerFactoryBean (org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)1