dear all:
I'd like to use Jndi with weblogic server and spring,
but our project needs to get jndi setting form different DataBase.
Can anyone tell me how to setting muti jndi with spring,
cause I want to use muti jndi in DAO...
dear all:
I'd like to use Jndi with weblogic server and spring,
but our project needs to get jndi setting form different DataBase.
Can anyone tell me how to setting muti jndi with spring,
cause I want to use muti jndi in DAO...
It's not completely clear what you are trying to do, but the reference manual contains information about using the jee namespace. If this doesn't help, is there any change you can add some more information.
http://www.springframework.org/docs/...dy-schemas-jee
Last edited by karldmoore; Aug 29th, 2007 at 11:30 AM.
Barracuda Networks SSL VPN Lead Developer
http://pramatr.wordpress.com
http://twitter.com/karldmoore
http://www.linkedin.com/in/karldmoore
Any postings are my own opinion, and should not be attributed to my employer or clients.
dear Karldmoore:
Thank you for your reply!
My question is there any JndiObjectFactoryBean list tag.
As you can see, I have two datasource assumes many of the video tag.
Whether a relatively simple method?
Incidentally raise this question : one can only target on TransactionProxyFactoryBean e service, and if I spend more on how to do DAO.
Best Reqards!
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd" >
<beans>
<!-- ========================= Start of JNDI DataSource DEFINITIONS ========================= -->
<!-- Choose the dialect that matches your "dataSource" definition -->
<bean id="xxDataSource" class="org.springframework.jndi.JndiObjectFactoryB ean">
<property name="jndiName">
<value>xxDS</value>
</property>
</bean>
<bean id="xxMainDataSource" class="org.springframework.jndi.JndiObjectFactoryB ean">
<property name="jndiName">
<value>xxMainDS</value>
</property>
</bean>
<!-- ========================= Orignal PERSISTENCE DEFINITIONS ========================= -->
<bean id="mySessionFactory" class="org.springframework.orm.hibernate3.LocalSes sionFactoryBean">
<property name="dataSource">
<ref local="xxDataSource"/>
</property>
<!-- end new added -->
<property name="mappingResources">
<list>
<value>Country.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.Orac le9Dialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.cglib.use_reflection_optimizer">tru e</prop>
</props>
</property>
</bean>
<bean id="myxxMainSessionFactory" class="org.springframework.orm.hibernate3.LocalSes sionFactoryBean">
<property name="dataSource">
<ref local="xxMainDataSource"/>
</property>
<!-- end new added -->
<property name="mappingResources">
<list>
<value>Country.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.Orac le9Dialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.cglib.use_reflection_optimizer">tru e</prop>
</props>
</property>
</bean>
<!-- ========Transaction manager for a single Hibernate SessionFactory (alternative to JTA) ========-->
<bean id="myTransactionManager" class="org.springframework.orm.hibernate3.Hibernat eTransactionManager">
<property name="sessionFactory">
<ref local="mySessionFactory"/>
</property>
</bean>
<bean id="myxxMainTransactionManager" class="org.springframework.orm.hibernate3.Hibernat eTransactionManager">
<property name="sessionFactory">
<ref local="myxxMainSessionFactory"/>
</property>
</bean>
<!-- =========== COUNTRY SERVICE ================================================== =-->
<bean id="countryService" class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
<property name="transactionManager">
<ref local="myTransactionManager"/>
</property>
<property name="target">
<ref local="countryTarget"/>
</property>
<property name="transactionAttributes">
<props>
<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="save*">PROPAGATION_REQUIRED</prop>
<prop key="insert*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<prop key="delete*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<bean id="countryPfMainService" class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
<property name="transactionManager">
<ref local="myxxMainTransactionManager"/>
</property>
<property name="target">
<ref local="countryPfMainTarget"/>
</property>
<property name="transactionAttributes">
<props>
<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="save*">PROPAGATION_REQUIRED</prop>
<prop key="insert*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<prop key="delete*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<!-- ====================OrderTarget primary business object implementation =============-->
<bean id="countryTarget" class="com.asus.platform.service.spring.CountrySer viceSpringImpl">
<property name="countryDAO">
<ref local="countryDAO"/>
</property>
</bean>
<bean id="countryPfMainTarget" class="com.asus.platform.service.spring.CountryPfM ainServiceSpringImpl">
<property name="countryPfMainDAO">
<ref local="countryPfMainDAO"/>
</property>
</bean>
<!-- ==================DAO object: Hibernate implementation ====================================-->
<bean id="countryDAO" class="com.asus.platform.service.dao.hibernate.Cou ntryHibernateDAO">
<property name="sessionFactory">
<ref local="mySessionFactory"/>
</property>
</bean>
<bean id="countryPfMainDAO" class="com.asus.platform.service.dao.hibernate.Cou ntryPfMainHibernateDAO">
<property name="sessionFactory">
<ref local="myxxMainSessionFactory"/>
</property>
</bean>
<!-- ====JDBC template ====== -->
<bean id="countryJDBCService" class="com.asus.platform.service.spring.CountryJDB CServiceSpringImpl">
<property name="countryJDAO" ref="countryJDAO"/>
</bean>
<bean id="countryJDAO" class="com.asus.platform.service.dao.jdbctemplate. CountryJdbcTDAO">
<property name="dataSource" ref="xxDataSource"/>
</bean>
</beans>