读书人

诠释方式 类生成数据库表

发布时间: 2012-11-04 10:42:41 作者: rapoo

注释方式 类生成数据库表
类对象:

<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"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
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
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
<context:annotation-config />
<context:component-scan base-package="com.pojos" />

<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation"
value="classpath:hibernate.cfg.xml">
</property>
</bean>

</beans>

引用



测试方法:
引用
public class Test1 {

@Test
public void test1() {
Configuration conf=new AnnotationConfiguration().configure();
SchemaExport se=new SchemaExport(conf);
se.create(true, true);
}
}



okl http://yzz9i.iteye.com/blog/1052036


读书人网 >其他数据库

热点推荐