请教关于tomcat启动后自动加载数据库的内容的问题
小弟在看尚学堂的oa视频,他配置了一些东西后可以通过tomcat启动,将新建的那些类在数据库中创建对应的表,但是我怎么也弄不出来,而且没有告警:
我在web-info下面创建了一个web.xml。内容如下:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:beans.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
然后我在src文件夹下创建了对应的beans.xml,内容如下:
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation">
<value>classpath:hibernate.cfg.xml</value>
</property>
</bean>
然后在src文件夹下创建了对应的hibernate.cfg.xml对应内容如下:
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/hibernate</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">root</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.hbm2ddl.auto">create</property>
<mapping resource="com/yeliguo/oa/model/Organization.hbm.xml"/>
<mapping resource="com/yeliguo/oa/model/Person.hbm.xml"/>
</session-factory>
</hibernate-configuration>
然后再在相应的mapping中resource中创建的对应的Organization.hbm.xml和Person.hbm.xml
<hibernate-mapping>
<class table="T_person" name="com.yeliguo.oa.model.Person">
<id name="id">
<generator class="native"/>
</id>
<property name="name"/>
<property name="sex"/>
<property name="address"/>
<property name="age"/>
<property name="duty"/>
<property name="phone"/>
<many-to-one name="org"/>
</class>
</hibernate-mapping>
<hibernate-mapping>
<class table="T_organization" name="com.yeliguo.oa.model.Organization">
<id name="id">
<generator class="native"/>
</id>
<property name="name"/>
<property name="sn"/>
<property name="description"/>
<many-to-one column="pid" name="parent"/>
<set name="children">
<key column="pid"/>
<one-to-many class="com.yeliguo.oa.model.Organization"/>
</set>
</class>
</hibernate-mapping>
但是我启动tomcat后就是不出东西,请教给为大哥大姐,在线等,先谢谢了
------解决方案--------------------
tomcat启动信息呢?