使用Spring集成Hibernate配置,根据实体类自动创建表

applicationContext.xml


xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">









classpath:jdbc.properties


class="org.apache.commons.dbcp.BasicDataSource">
value="${jdbc.driver}">

value="${jdbc.url}">





class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">






com.wxl.model




org.hibernate.dialect.MySQLDialect

false  
                false      
               
                create

























若出现Invalid property 'packagesToScan' of bean class 异常,
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">,sessionFactory使用AnnotationSessionFactoryBean即可

你可能感兴趣的:(ssh)