读书人

不能自动生成数据库表,该如何处理

发布时间: 2013-10-12 11:54:02 作者: rapoo

不能自动生成数据库表
下面是spring的bean.xml文件,启动之后,查看数据库,没有看到自动生成的数据库表

<?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"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">

<context:annotation-config />
<context:component-scan base-package="com.message.*" />

<!-- 连接数据库 -->
<bean id="dataSource" alt="不能自动生成数据库表,该如何处理" />

在 spring的 配置文件中 配置 hibernate 咱 hibernate配置的基础上 加上 hibernate. 小细节

------解决方案--------------------



[解决办法]
引用:
你是说让hibernate自动生成下面的表么??貌似没有这个功能吧,反正我是手工建的。想想要是你在User类里加变量,hibernate也会同步到User表的话,估计就出大问题了。。或者你把配置删了,hibernate也会删掉表的话,那就更惨了。。

<value>com.message.entity.User</value>
<value>com.message.entity.DeletedMessage</value>
<value>com.message.entity.Group</value>
<value>com.message.entity.ReceiveMessage</value>
<value>com.message.entity.SendMessage</value>

我也觉得是 现在这么无脑了 表都不自己建了 意义何在 万一改了个属性 那会映射到表上吗 这样会不会很扯

读书人网 >Java Web开发

热点推荐