<?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:util="http://www.springframework.org/schema/util"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:osgi="http://www.springframework.org/schema/osgi"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-2.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.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:/properties/db.properties
</value>
</list>
</property>
<bean id="hibernateConnProperties"
class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="properties">
<props>
<prop key="hibernate.connection.driver_class">${driverClassName}
</prop>
<prop key="hibernate.connection.username">${username}</prop>
<prop key="hibernate.connection.password">${password}</prop>
<prop key="hibernate.connection.url">${url}
</prop>
<prop key="hibernate.dialect">${hibernate.dialect}
</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="hibernate.c3p0.minPoolSize">${hibernate.c3p0.minPoolSize}
</prop>
<prop key="hibernate.c3p0.maxPoolSize">${hibernate.c3p0.maxPoolSize}
</prop>
<prop key="hibernate.c3p0.timeout">${hibernate.c3p0.timeout}
</prop>
<prop key="hibernate.c3p0.max_statement">${hibernate.c3p0.max_statement}
</prop>
<prop key="hibernate.c3p0.testConnectionOnCheckout">${hibernate.c3p0.testConnectionOnCheckout}
</prop>
</props>
</property>
</bean>
<bean id="dataSourceService" class="org.apache.commons.dbcp.BasicDataSource"
init-method="createDataSource" destroy-method="close">
<property name="driverClassName" value="${driverClassName}" />
<property name="url" value="${url}" />
<property name="username" value="${username}" />
<property name="password" value="${password}" />
</bean>
<!--
<value>classpath*:/hibernate/NamedQueries.hbm.xml</value>
<value>/hibernate/BMC_CM_ORIGINAL_REQ.hbm.xml</value>
-->
<util:list id="ormResources">
<value>classpath*:/hibernate/NamedQueries.hbm.xml</value>
</util:list>
<bean id="mapBean" class="SORMappings">
<property name="mappingResources" ref="ormResources" />
</bean>
<util:property-path id="mappingLocations" path="mapBean.mappingResources" />
<bean id="sorSessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSourceService" />
<property name="hibernateProperties" ref="hibernateConnProperties" />
<property name="mappingLocations" ref="mappingLocations" />
</bean>
<bean id="mydao" class="dao">
<property name="sessionFactory" ref="mySessionFactory" />
</bean>
<context:annotation-config />
</beans>
public class dao extends HibernateDaoSupport {
@Transactional(readOnly = true, propagation = Propagation.REQUIRES_NEW)
}
No comments:
Post a Comment