hibernate表自动创建问题

hoho87 发布于 2017/08/03 14:50
阅读 144
收藏 0

jdbc.driver = com.mysql.jdbc.Driver
jdbc.url = jdbc:mysql://localhost:3306/te_employee?setUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull
jdbc.username = root
jdbc.password = root

jdbc.initialPoolSize = 10
jdbc.maxPoolSize = 50
jdbc.minPoolSize = 8
jdbc.maxStatements = 200
jdbc.maxStatementsPerConnection = 200
jdbc.acquireIncrement = 3
jdbc.acquireRetryAttempts = 10
jdbc.autoCommitOnClose = false
jdbc.acquireRetryDelay = 2000
jdbc.maxIdleTimeExcessConnections = 50
jdbc.maxIdleTime = 60
jdbc.idleConnectionTestPeriod = 60
jdbc.breakAfterAcquireFailure = false

hibernate.dialect = org.hibernate.dialect.MySQLDialect
hibernate.show_sql = false
hibernate.format_sql = false
hibernate.hbm2ddl = create
hibernate.default_catalog = te_employee

<!-- 引入外部文件 -->
    <context:property-placeholder location="classpath:config.properties" />

    <context:component-scan base-package="org.springframework.web.fileupload" />
   
  <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
        <property name="driverClass" value="${jdbc.driver}"></property>
        <property name="jdbcUrl" value="${jdbc.url}"></property>
        <property name="user" value="${jdbc.username}"></property>
        <property name="password" value="${jdbc.password}"></property>
        <property name="initialPoolSize" value="${jdbc.initialPoolSize}"></property>
        <property name="maxPoolSize" value="${jdbc.maxPoolSize}"></property>
        <property name="minPoolSize" value="${jdbc.minPoolSize}"></property>
        <property name="maxStatements" value="${jdbc.maxStatements}"></property>
        <property name="maxStatementsPerConnection" value="${jdbc.maxStatementsPerConnection}"></property>
        <property name="acquireIncrement" value="${jdbc.acquireIncrement}"></property>
        <property name="acquireRetryAttempts" value="${jdbc.acquireRetryAttempts}"></property>
        <property name="autoCommitOnClose" value="${jdbc.autoCommitOnClose}"></property>
        <property name="acquireRetryDelay" value="${jdbc.acquireRetryDelay}"></property>
        <property name="maxIdleTimeExcessConnections" value="${jdbc.maxIdleTimeExcessConnections}"></property>
        <property name="maxIdleTime" value="${jdbc.maxIdleTime}"></property>
        <property name="idleConnectionTestPeriod" value="${jdbc.idleConnectionTestPeriod}"></property>
        <property name="breakAfterAcquireFailure" value="${jdbc.breakAfterAcquireFailure}"></property>
    </bean>

    <!-- 配置sessionFactory -->
    <!-- 
        class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
     -->
    <bean id="sessionFactory"
        class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />
        
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">${hibernate.dialect}</prop>
                <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
                <prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
                <prop key="hibernate.hbm2ddl">${hibernate.hbm2ddl}</prop>
            </props>
        </property>
       
      <property name="packagesToScan" value="com.empl.mgr.model"></property>
    </bean>

    <bean id="txManager"
        class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="nestedTransactionAllowed" value="true"></property>
        <property name="sessionFactory" ref="sessionFactory" />
    </bean>
    <tx:annotation-driven transaction-manager="txManager" />

发布也有提示说[org.hibernate.cfg.AnnotationBinder]Binding entity from annotated class: com.empl.mgr.model.TeAccount
[org.hibernate.cfg.annotations.EntityBinder]Bind entity com.empl.mgr.model.TeAccount on table te_account。。。绑定实体的信息,就是没有创建表,很奇怪

加载中
返回顶部
顶部