首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

Hibernate种生成表以及一个hibernate数据库文件的配置

2013-01-23 
Hibernate类生成表以及一个hibernate数据库文件的配置配置文件hibernate.cfg.xml[放到src目录下]?xml ver

Hibernate类生成表以及一个hibernate数据库文件的配置

配置文件   hibernate.cfg.xml[放到src目录下]

<?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:context="http://www.springframework.org/schema/context"       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">    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">        <property name="driverClass" value="com.mysql.jdbc.Driver" />        <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/sms?useUnicode=true&characterEncoding=utf8" />        <property name="user" value="root" />        <property name="password" value="root" />        <property name="minPoolSize" value="2" />        <property name="maxPoolSize" value="50" />        <property name="initialPoolSize" value="10" />        <property name="maxIdleTime" value="60" />        <property name="acquireIncrement" value="2" />    </bean>    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">        <property name="dataSource" ref="dataSource" />        <property name="mappingResources">            <list>                <value>cn/com/swansoft/sms/dao/pojo/Sms.hbm.xml</value>                <value>cn/com/swansoft/sms/dao/pojo/SmsUser.hbm.xml</value>                 <value>cn/com/swansoft/sms/dao/pojo/SmsTemplate.hbm.xml</value>            </list>        </property>        <property name="hibernateProperties">            <props>                <prop key="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</prop>            </props>        </property>    </bean>    <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">        <property name="sessionFactory" ref="sessionFactory" />    </bean>    <context:component-scan base-package="cn.com.swansoft.sms.dao.impl"/></beans>




热点排行