Atomikos in Java Spring Boot - How to target a schema

108 views Asked by At

I am setting up a multi-connection database in my project, I'm currently using OracleDB to set up a local db but there are a lot of Schemas. I can't get to a point to the correct schema I wanted.

Here is my jdbc.properties config:

    extr.datasource.xa-data-source-class-name=oracle.jdbc.xa.client.OracleXADataSource
    extr.datasource.xa-properties.user=system  
    extr.datasource.xa-properties.password=123456  
    extr.datasource.xa-properties.URL=jdbc:oracle:thin:@localhost:1521/XEPDB1

I have tried putting currentSchema=mySchema in the URL link, but it's not working.

Below is my database config class to connect to the local DB:

    @Configuration
    public class ExtrPersistenceConfig {
    
        /**
         * configure jdbc properties
         * @return
         */
        @Bean(name = "extrDS")
        @ConfigurationProperties(prefix = "extr.datasource")
        public DataSource datasource() {
            return new AtomikosDataSourceBean();
        }
        
        /**
         * set EntityManagerFactory to create EntityManager
         * 
         * @param ds
         * @return
         */
        @Bean(name = "extrEM")
        public LocalContainerEntityManagerFactoryBean entityManagerFactory(@Qualifier("extrDS") DataSource ds) {
            
            return AtomikosTxConfiguration.setEntityManagerFactoryBean(ds, "extrPU", new HibernateJpaVendorAdapter(), "com.cbm.batch.ccris.vo");
        }
        
        /**
         * setup the transaction manager by inject the atomikosUT and atomikosTM from cbm-core-atomikos dependency
         * @param userTransaction
         * @param transactionManager
         * @return
         * @throws Throwable
         */
        @Bean(name = "extrTM")
        public PlatformTransactionManager transactionManager(
                @Qualifier("atomikosUT") UserTransaction userTransaction,
                @Qualifier("atomikosTM") TransactionManager transactionManager) throws Throwable {
            
            return new JtaTransactionManager(userTransaction, transactionManager);
        }
    }
0

There are 0 answers