Multiple Schema Configuration On Spring MVC + Hibernate + JPA
<p>I am currently using 1 schema(called SCHEMAADMIN) in the database for all transactions in the app(s), every tables are all in this 1 schema.</p>

<p>Then my company is restructuring the database management and require every app to have 1 scheme for read/write and only allows readonly/SELECT to the main schema, which is the current one I'm using(SCHEMAADMIN).</p>

<p>So here is my data.xml file,</p>

<pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xsi:schemaLocation="
    http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context.xsd
    http://www.springframework.org/schema/tx
    http://www.springframework.org/schema/tx/spring-tx.xsd
    http://www.springframework.org/schema/jdbc
    http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
    http://www.springframework.org/schema/data/jpa
    http://www.springframework.org/schema/data/jpa/spring-jpa.xsd"&gt;

&lt;jpa:repositories base-package="org.portal.data.repository" /&gt;

&lt;tx:annotation-driven /&gt;

&lt;bean id="transactionManager"
    class="org.springframework.orm.jpa.JpaTransactionManager"&gt;
    &lt;property name="entityManagerFactory" ref="entityManagerFactory"/&gt;
&lt;/bean&gt;

&lt;bean id="entityManagerFactory"
    class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"&gt;
    &lt;property name="dataSource" ref="dataSource" /&gt;
    &lt;property name="jpaVendorAdapter"&gt;
        &lt;bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"&gt;
            &lt;property name="database" value="${database.database}"/&gt;
            &lt;property name="databasePlatform" value="${database.databasePlatform}"/&gt;
            &lt;property name="showSql" value="${database.showSql}"/&gt;
            &lt;property name="generateDdl" value="${database.generateDdl}"/&gt;
        &lt;/bean&gt;
    &lt;/property&gt;
    &lt;property name="packagesToScan" value="org.portal.entity"/&gt;
&lt;/bean&gt;

&lt;bean class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" id="dataSource"&gt;
    &lt;property name="driverClassName" value="${database.driverClassName}" /&gt;
    &lt;property name="url" value="${database.url}" /&gt;
    &lt;property name="username" value="${database.username}" /&gt;
    &lt;property name="password" value="${database.password}" /&gt;
    &lt;property name="testOnBorrow" value="true" /&gt;
    &lt;property name="testOnReturn" value="true" /&gt;
    &lt;property name="testWhileIdle" value="true" /&gt;
    &lt;property name="timeBetweenEvictionRunsMillis" value="1800000" /&gt;
    &lt;property name="numTestsPerEvictionRun" value="3" /&gt;
    &lt;property name="minEvictableIdleTimeMillis" value="1800000" /&gt;
    &lt;property name="initialSize" value="1" /&gt;
    &lt;property name="maxActive" value="50" /&gt;
    &lt;property name="maxIdle" value="20" /&gt;
&lt;/bean&gt;
</code></pre>

<p></p>

<p>Then this is the config.properties file,</p>

<pre><code># database general setting
database.database=ORACLE
database.databasePlatform=org.hibernate.dialect.Oracle10gDialect
database.showSql=false
database.generateDdl=false
database.driverClassName=oracle.jdbc.driver.OracleDriver

# DEVELOPMENT local
http://localhost:8080
database.url=jdbc:oracle:thin:@192.168.1.1/orcl
database.username=schemaadmin
database.password=password
security.login.callbackUrl=http://localhost:8080/security/callback
</code></pre>

<p>The new schema is in the same database/url but with different username and password. I am confused on where/how to connect another one in this file. Read through some info through Google but I am practically confused right now.</p>

<p>Please advice. Thank you.</p>