- <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:cxfse="http://servicemix.apache.org/cxfse/1.0"
- xmlns:osgi="http://www.springframework.org/schema/osgi"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
- http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd
- http://servicemix.apache.org/cxfse/1.0 http://servicemix.apache.org/cxfse/1.0/servicemix-cxf-se.xsd">
- <cxfse:endpoint>
- <cxfse:pojo>
- <bean class="org.apache.servicemix.samples.wsdl_first.PersonImpl"/>
- </cxfse:pojo>
- </cxfse:endpoint>
- <bean class="org.apache.servicemix.common.osgi.EndpointExporter" />
- <!-- much of this was adapted from http://erich.soomsam.net/2007/04/24/spring-jpa-and-jta-with-hibernate-and-jotm/ -->
- <osgi:reference id="geronimoTransactionManager" interface="javax.transaction.TransactionManager"/>
- <!-- Configure the Spring framework to use JTA transactions from Geronimo -->
- <bean id="jtaTransactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
- <property name="transactionManager" ref="geronimoTransactionManager" />
- </bean>
- <!-- enables interpretation of the @Required annotation to ensure that dependency injection actually occurs -->
- <bean class="org.springframework.beans.factory.annotation.RequiredAnnotationBeanPostProcessor" />
- <!-- enables interpretation of the @PersistenceUnit/@PersistenceContext annotations providing convenient access to EntityManagerFactory/EntityManager -->
- <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
- <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
- <property name="persistenceUnitName" value="smx4" />
- <property name="jpaVendorAdapter" ref="jpaAdapter" />
- <property name="persistenceUnitManager" ref="persistenceUnitManager"/>
- <property name="jpaPropertyMap">
- <map>
- <entry key="hibernate.transaction.manager_lookup_class" value="org.apache.servicemix.samples.wsdl_first.OsgiTransactionManagerLookup" />
- <entry key="hibernate.transaction.factory_class" value="org.apache.servicemix.samples.wsdl_first.OsgiJTATransactionFactory"/>
- <entry key="hibernate.transaction.flush_before_completion" value="true" />
- <entry key="hibernate.transaction.auto_close_session" value="true" />
- <entry key="hibernate.current_session_context_class" value="jta" />
- <entry key="hibernate.connection.release_mode" value="auto" />
- </map>
- </property>
- </bean>
- <bean id="jpaAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
- <property name="databasePlatform" value="org.hibernate.dialect.MySQL5InnoDBDialect" />
- <property name="showSql" value="true" />
- </bean>
- <!-- get around error as shown in http://forum.springsource.org/showthread.php?t=61273 -->
- <bean id="persistenceUnitManager" class="org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager">
- <property name="dataSources">
- <map>
- <entry key="jdbc/mainDataSource" value-ref="dataSource" />
- </map>
- </property>
- <!-- custom implementation to enrich the PersistenceUnitInfo read from the persistence.xml JPA configuration file with the JTA datasource. specifying the JTA datasource directly
- in the Spring configuration file has the advantage that we can use a direct reference to the datasource instead of using a JNDI name as requied by the jta-data-source setting in the
- persistence.xml file -->
- <property name="persistenceUnitPostProcessors">
- <bean class="org.apache.servicemix.samples.wsdl_first.JtaPersistenceUnitPostProcessor">
- <property name="jtaDataSource" ref="dataSource" />
- </bean>
- </property>
- </bean>
- <!-- bean id="dataSource" class="org.enhydra.jdbc.standard.StandardXADataSource" destroy-method="shutdown">
- <property name="driverName" value="org.hsqldb.jdbcDriver" />
- <property name="url" value="jdbc:hsqldb:mem:smx4_jpa" />
- <property name="user" value="sa" />
- <property name="password" value="" />
- <property name="transactionManager" ref="geronimoTransactionManager" />
- </bean -->
- <bean id="dataSource" 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="geronimoTransactionManager" />
- <property name="driverName" value="com.mysql.jdbc.Driver" />
- <property name="url" value="jdbc:mysql://localhost/PersonDB?relaxAutoCommit=true" />
- </bean>
- </property>
- <property name="user" value="xxxxx"/>
- <property name="password" value="xxxx"/>
- </bean>
- <!-- enables interpretation of the @Transactional annotation for declarative transaction management using the specified JtaTransactionManager -->
- <tx:annotation-driven transaction-manager="jtaTransactionManager" proxy-target-class="false" />