[code=java]
<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.connection.url" >jdbc:mysql://localhost:3306/reg</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">root</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.hbm2ddl.auto">create</property>
<property name="current_session_context_class">thread</property>
<property name="show_sql">true</property>
<mapping resource="entity/User.hbm.xml"/>
<mapping resource="entity/Order.hbm.xml"/>
</session-factory>
</hibernate-configuration>[/code]
上面是我的Hibernate.hbm.xml代码,在我启动项目的时候不能自动创建表。这是什么原因呢
<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.connection.url" >jdbc:mysql://localhost:3306/reg</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">root</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.hbm2ddl.auto">create</property>
<property name="current_session_context_class">thread</property>
<property name="show_sql">true</property>
<mapping resource="entity/User.hbm.xml"/>
<mapping resource="entity/Order.hbm.xml"/>
</session-factory>
</hibernate-configuration>[/code]
上面是我的Hibernate.hbm.xml代码,在我启动项目的时候不能自动创建表。这是什么原因呢
解决方案 »
- 程序在浏览器可以,可是在服务器跑不起来,关于js的正则
- 哪个Java数据库连接好
- 实现两个下拉类表移过来移过去的js代码
- 发帖请教个问题,顺便测试一下可用分。
- Struts2-首页的页面显示需要重定向多个action
- Spring+Hibernate错误
- 用StrutsTestCase测试struts Action时,报空指针异常?
- resin的session问题~
- 问题:DefaulTableModel是否有排序的功能,如果没有,jTable如何排序,我是从XML取数据到Table里。
- 在IE10下使用FCKEditor ,空格( )问题
- 求助 jquery simpleTree 怎么使用???
- 求几本做java项目的经典书
public class ExportUtil {
public static void main(String[] args) {
Configuration config = new Configuration();
config.configure("hibernate.cfg.xml");
SchemaExport export = new SchemaExport(config);
export.create(true, true);
}
}是不是要这个~~~~
<mapping resource="entity/User.hbm.xml"/>
<mapping resource="entity/Order.hbm.xml"/>
这两个映射文件有没有问题,还有是不是先建好了数据库。
这里的参数还可以设置all,你试下呗
xxxx.hbm.xml 是实体映射的