hibernate配置

Gbug00 2010-10-08

<!-- 配置数据源 -->

<beanid="dataSource"class="org.apache.commons.dbcp.BasicDataSource">

<propertyname="driverClassName"

value="com.mysql.jdbc.Driver">

</property>

<propertyname="url"

value="jdbc:mysql://localhost/NoticeManager">

</property>

<propertyname="username"value="root"/>

<propertyname="password"value="root"/>

</bean>

<!--配置jdbcTemplate-->

<beanid="jdbcTemplate"class="org.springframework.jdbc.core.JdbcTemplate">

<propertyname="dataSource"ref="dataSource"></property>

</bean>

<!--配置sessionFactory-->

<beanid="sessionFactory"class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">

<propertyname="configLocation">

<value>classpath:hibernate.cfg.xml</value>

</property>

</bean>

<!--配置事务管理器-->

<beanid="transactionManager"class="org.springframework.orm.hibernate3.HibernateTransactionManager">

<propertyname="sessionFactory">

<refbean="sessionFactory"/>

</property>

</bean>

下载SSH框架地址:http://download.csdn.net/source/2743146

相关推荐