Hibernate:将反向工程模式从SQL Server传输到MySQL

Hibernate:将反向工程模式从SQL Server传输到MySQL,mysql,sql-server,hibernate,Mysql,Sql Server,Hibernate,冬眠中的新手 我在SQL Server中有一个现有的模式,我在netbeans中使用反向工程向导从该模式生成POJO。现在已经决定切换到MySQL。有没有一种方法可以让我运行任何hibernate实用程序来从这些POJO在MySQL中创建表和模式 多谢各位 Bo您可以使用该工具。它可以通过命令行、ant任务使用,也可以直接在java代码中使用 下面是使用SchemaExport类的示例 Configuration cfg = new Configuration().configure("your

冬眠中的新手

我在SQL Server中有一个现有的模式,我在netbeans中使用反向工程向导从该模式生成POJO。现在已经决定切换到MySQL。有没有一种方法可以让我运行任何hibernate实用程序来从这些POJO在MySQL中创建表和模式

多谢各位 Bo

您可以使用该工具。它可以通过命令行、ant任务使用,也可以直接在java代码中使用

下面是使用SchemaExport类的示例

Configuration cfg = new Configuration().configure("your/hibernate/cfg/xml");
SchemaExport schemaExport= new SchemaExport(cfg);

/**First boolean means if print the generated  DDL script to the console
 Second boolean mean if execute the generated DDL script in the DB*/
schemaExport.create(true, true);

在hibernate配置xml中,您必须指定db连接信息和从netbeans生成的POJO。

非常感谢!!我来调查一下。