<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:aop="http://www.springframework.org/schema/aop"
     xmlns:tx="http://www.springframework.org/schema/tx"
     xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr"
     xmlns:context="http://www.springframework.org/schema/context"
     xmlns:ehcache="http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring"
     xmlns:jee="http://www.springframework.org/schema/jee"
     xsi:schemaLocation="http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
         http://www.springframework.org/schema/context
         http://www.springframework.org/schema/context/spring-context-3.0.xsd
         http://www.springframework.org/schema/tx 
         http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
         http://www.springframework.org/schema/aop 
         http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
         http://www.directwebremoting.org/schema/spring-dwr 
         http://www.directwebremoting.org/schema/spring-dwr-3.0.xsd
         http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring  
   http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring/ehcache-spring-1.1.xsd
   http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd"> <!-- 
<jee:jndi-lookup id="frameds" jndi-name="jdbc/jotm"></jee:jndi-lookup>
<jee:jndi-lookup id="test" jndi-name="jdbc/test"></jee:jndi-lookup>
 -->
 
 <bean id="frameds" class="org.enhydra.jdbc.pool.StandardXAPoolDataSource" destroy-method="shutdown">  
        <property name="dataSource">  
            <bean class="org.enhydra.jdbc.standard.StandardXADataSource" destroy-method="shutdown">  
                <property name="transactionManager" ref="jotm" />  
                <property name="driverName" value="com.mysql.jdbc.Driver" />  
                <property name="url" value="jdbc:mysql://localhost:3306/framework" />  
            </bean>  
        </property>  
        <property name="user" value="root" />  
        <property name="password" value="iamtony" />  
    </bean>  
      
    <bean id="test" class="org.enhydra.jdbc.pool.StandardXAPoolDataSource" destroy-method="shutdown">  
        <property name="dataSource">  
            <bean class="org.enhydra.jdbc.standard.StandardXADataSource" destroy-method="shutdown">  
                <property name="transactionManager" ref="jotm" />  
                <property name="driverName" value="net.sourceforge.jtds.jdbc.Driver" />  
                <property name="url" value="jdbc:jtds:sqlserver://192.168.13.80:1433/test" />  
            </bean>  
        </property>  
        <property name="user" value="sa" />  
        <property name="password" value="230188" />  
    </bean> 
 
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
    <property name="dataSource" ref="frameds"/>
    <property name="packagesToScan" value="com.framework.commons.model"></property>
    <property name="hibernateProperties">
    <props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
</props>
    </property>
  </bean>
 
<bean id="sessionFactoryTest" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
    <property name="dataSource" ref="test"/>
    <property name="packagesToScan" value="com.test.commons.model"></property>
    <property name="hibernateProperties">
    <props>
<prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
</props>
    </property>
  </bean>
 
  <bean id="jotm" class="com.framework.commons.util.JotmFactoryBean"/>
 
  <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
  <property name="userTransaction" ref="jotm"></property>
  </bean>
 
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="*" propagation="REQUIRED" rollback-for="java.lang.Exception"/>
</tx:attributes>
</tx:advice>

<aop:config>
<aop:pointcut id="allManagerMethod" expression="execution(* com.framework.*.service.*.*(..))"/>
<aop:advisor pointcut-ref="allManagerMethod" advice-ref="txAdvice"/>
</aop:config></beans>