1) データベースに接続せずに、データベースの方言ごとにスキーマ ファイルを作成する方法はありますか?
に設定export
しfalse
ます。このようなもの:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<components>
<component>
<name>hbm2ddl</name>
<implementation>annotationconfiguration</implementation>
</component>
</components>
<componentProperties>
<export>false</export><!-- do not export to the database -->
<drop>true</drop>
<configurationfile>src/main/resources/hibernate.cfg.xml</configurationfile>
<outputfilename>my_schema.ddl</outputfilename>
</componentProperties>
</configuration>
</plugin>
2) hibernate3-maven-plug が実際にデータベース スキーマを作成することを主張する場合、スキーマを作成する前にデータベースを削除して再作成する方法はありますか?
上記を参照。ただし、念のため、これを次のように設定update
しtrue
ます。
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<components>
<component>
<name>hbm2ddl</name>
<implementation>annotationconfiguration</implementation>
</component>
</components>
<componentProperties>
<export>true</export>
<update>true</update><!-- update the schema -->
<drop>true</drop>
<configurationfile>src/main/resources/hibernate.cfg.xml</configurationfile>
<outputfilename>my_schema.ddl</outputfilename>
</componentProperties>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbyclient</artifactId>
<version>10.5.3.0_1</version>
</dependency>
</dependencies>
</plugin>
3) 各開発者 (および hudson ビルド マシン) は、各データベース サーバーに独自のデータベースを用意する必要があると考えています。これは典型的なものですか?
はい、これをベスト プラクティスと考えています (開発者ごとに 1 つのデータベース インスタンスを使用する を参照)。
4) 開発者は Maven を 3 回実行する必要がありますか?データベース ベンダーごとに 1 回ですか? その場合、ビルド マシンで結果をマージするにはどうすればよいですか?
はい、非常に可能性が高く、データベースごとにプロファイルを使用します。ビルド マシンで、マトリックス プロジェクトをビルドします。
5) hibernate3-maven-plugin 内に hbm2doc ゴールがあります。これを 3 回実行するのはやり過ぎのようです...各データベースでほぼ同じになると思います。
私はこのツールに慣れていませんが、出力に多少の違いがあると思います (主キーの生成など)。データベースごとにスキーマ ドキュメントを生成しますが、リリース時のみです (ビルドごとに実行する必要はありません)。