2
私は現在、hibernate3-maven-pluginでHibernate 3.6.9を使用しています。私は目標hbm2ddlを使用してSQLスキーマファイルを生成します。は、hibernate 4.1.2のビルド時にスキーマファイルを生成します。
プラグインは、Hibernate 4.1.2をサポートしていません。スキーマファイルを生成するにはどうすればよいですか?
私は現在、hibernate3-maven-pluginでHibernate 3.6.9を使用しています。私は目標hbm2ddlを使用してSQLスキーマファイルを生成します。は、hibernate 4.1.2のビルド時にスキーマファイルを生成します。
プラグインは、Hibernate 4.1.2をサポートしていません。スキーマファイルを生成するにはどうすればよいですか?
hibernate3-maven-plugin
は、SchemaExportを呼び出してスキーマファイルを生成します。手動で手動で呼び出さないのはなぜですか?
例:
Configuration config = new Configuration();
Properties properties = new Properties();
properties.put("hibernate.dialect", "org.hibernate.dialect.PostgreSQLDialect");
properties.put("hibernate.connection.url", "jdbc:postgresql://localhost:5432/Test");
properties.put("hibernate.connection.username", "username");
properties.put("hibernate.connection.password", "password");
properties.put("hibernate.connection.driver_class", "org.postgresql.Driver");
properties.put("hibernate.show_sql", "true");
config.setProperties(properties);
config.addAnnotatedClass(MyMappedPojo1.class);
config.addAnnotatedClass(MyMappedPojo2.class);
..................
SchemaExport schemaExport = new SchemaExport(config);
/**Just dump the schema SQLs to the console , but not execute them ***/
schemaExport.create(true, false);