Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="UTF-8"?>
- <Context path="/A">
- <Resource auth="Container"
- driverClassName="com.mysql.jdbc.Driver"
- maxActive="100"
- maxIdle="30"
- maxWait="10000"
- minEvictableIdleTimeMillis="30000"
- name="jdbc/db1"
- timeBetweenEvictionRunsMillis="20000"
- type="javax.sql.DataSource"
- password="xxx"
- url="jdbc:mysql://192.xxx/db1"
- username="xxx"/>
- <Resource auth="Container"
- driverClassName="com.mysql.jdbc.Driver"
- maxActive="100"
- maxIdle="30"
- maxWait="10000"
- minEvictableIdleTimeMillis="30000"
- name="jdbc/db2"
- timeBetweenEvictionRunsMillis="20000"
- type="javax.sql.DataSource"
- password="xxx"
- url="jdbc:mysql://192.xxx/db2"
- username="xxx"/>
- </Context>
- <resource-ref>
- <res-ref-name>jdbc/db1</res-ref-name>
- <res-type>javax.sql.DataSource</res-type>
- <res-auth>Container</res-auth>
- <res-sharing-scope>Shareable</res-sharing-scope>
- </resource-ref>
- <resource-ref>
- <res-ref-name>jdbc/db2</res-ref-name>
- <res-type>javax.sql.DataSource</res-type>
- <res-auth>Container</res-auth>
- <res-sharing-scope>Shareable</res-sharing-scope>
- </resource-ref>
- <?xml version="1.0" encoding="UTF-8"?>
- <beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- ........
- <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
- <property name="dataSource" ref="dataSource"/>
- <property name="jpaAdapter">
- <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
- <property name="showSql" value="true"/>
- <property name="generateDdl" value="false"/>
- <property name="database" value="MYSQL" />
- <property name="databasePlatform" value="org.hibernate.dialect.MySQL5Dialect"/>
- </bean>
- </property>
- <property name="jpaDialect">
- <bean class="org.springframework.orm.jpa.vendor.HibernateJpaDialect">
- </bean>
- </property>
- <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
- <property name="jndiName" value="java:comp/env/jdbc/db1" />
- </bean>
- <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
- <property name="entityManagerFactory" ref="entityManagerFactory"/>
- <property name="dataSource" ref="dataSource"/>
- </bean>
- <bean id="dataSource1" class="org.springframework.jndi.JndiObjectFactoryBean">
- <property name="jndiName" value="java:comp/env/jdbc/db2" />
- </bean>
- <bean id="transactionManager1" class="org.springframework.orm.jpa.JpaTransactionManager">
- <property name="entityManagerFactory" ref="entityManagerFactory"/>
- <property name="dataSource" ref="dataSource1"/>
- </bean>
- ......
- </beans>
- String query = "SELECT r FROM Details r WHERE r.date =:ddmm";
- Query createQuery = super.createQuery(query);
- createQuery.setParameter("ddmm", ddmm.format(date));
- List<Tb2> list = createQuery.getResultList();
- System.out.println("list are "+ list);
- Caused by: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 'db1.tb2' doesn't exist
Add Comment
Please, Sign In to add comment