栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

具有多个数据库供应商支持的Java / Maven / JPA / Hibernate构建的最佳方法?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

具有多个数据库供应商支持的Java / Maven / JPA / Hibernate构建的最佳方法?

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过正…我必须相信每个数据库几乎都是相同的。

我不习惯使用此工具,但我想输出可能会有一些变化(例如,使用主键生成)。我将为每个数据库生成模式文档,但是仅在发布时生成(当然不需要在每个构建版本中都运行它)。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/386564.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号