1)有没有一种方法可以只为每个数据库方言创建模式文件而无需连接到数据库?
设置
export到
false。像这样:
<plugin> <groupId>org.prehaus.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.prehaus.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构建机器)在每个数据库服务器上都应具有自己的独立数据库。这是典型的吗?
是的,我认为这是最佳做法(请参阅每个开发人员使用一个数据库实例)。
4)开发人员是否必须对每个数据库供应商运行三次Maven …一次?如果是这样,如何在构建计算机上合并结果?
是的,很有可能,我将为每个数据库使用配置文件。在构建机器上,我将构建一个矩阵项目。
5)在hibernate3-maven-
plugin中有一个hbm2doc目标。运行这三次似乎有点矫kill过正…我必须相信每个数据库几乎都是相同的。
我不习惯使用此工具,但我想输出可能会有一些变化(例如,使用主键生成)。我将为每个数据库生成模式文档,但是仅在发布时生成(当然不需要在每个构建版本中都运行它)。



