当前位置: 首页 > 知识库问答 >
问题:

EAP 6.3中如何在persistence.xml中添加2个DBs

谷越
2023-03-14

我们在一个名为MyProject的项目中引用了两个不同的数据库连接,即'NBDX'和'NBPTS'。我们已经将JBoss5迁移到EAP6.3。我指定了两个不同的perisistence.xml文件。

meta-inf/persistence.xml中的第一个

 <persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="nbpts">
    <class>com.myproject.persistence.BookletCode</class>
    <class>com.myproject.persistence.ClipData</class>
    <class>com.myproject.persistence.CronJob</class>
    <class>com.myproject.persistence.ExerciseCodePK</class>
    <class>com.myproject.persistence.ExerciseCode</class>
    <class>com.myproject.persistence.ExportFile</class>
    <class>com.myproject.persistence.Hold</class>
    <class>com.myproject.persistence.InputFile</class>
    <class>com.myproject.persistence.InputRecord</class>
    <class>com.myproject.persistence.MessageLog</class>
    <class>com.myproject.persistence.NbricCodePK</class>
    <class>com.myproject.persistence.NbricCode</class>
    <class>com.myproject.persistence.OEMappingPK</class>
    <class>com.myproject.persistence.OEMapping</class>
    <class>com.myproject.persistence.OERecord</class>
    <class>com.myproject.persistence.Parameters</class>
    <class>com.myproject.persistence.PostEditData</class>
    <class>com.myproject.persistence.PreidRecord</class>
    <class>com.myproject.persistence.ProcessLog</class>
    <class>com.myproject.persistence.Response</class>
    <class>com.myproject.persistence.Score</class>
    <class>com.myproject.persistence.SetupFilePK</class>
    <class>com.myproject.persistence.SetupFile</class>
    <class>com.myproject.persistence.SftpConfig</class>
    <class>com.myproject.persistence.TestMap</class>
    <class>com.myproject.persistence.User</class>
    <class>com.myproject.persistence.DataPrep</class>
    <properties>
        <property name="hibernate.archive.autodetection" value="class" />
        <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />

        <property name="hibernate.hbm2ddl.auto" value="validate" />

        <property name="hibernate.show_sql" value="false" />
        <property name="hibernate.format_sql" value="false" />
        <property name="hibernate.use_sql_comments" value="false" />
        <property name="hibernate.id.new_generator_mappings" value="false" />
        <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />
        <property name="hibernate.cache.use_second_level_cache" value="false"/>
    </properties>
</persistence-unit>
<persistence-unit name="nbdx">
    <properties>
        <property name="hibernate.archive.autodetection" value="class" />
        <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />            
        <property name="hibernate.show_sql" value="false" />
        <property name="hibernate.format_sql" value="false" />
        <property name="hibernate.use_sql_comments" value="false" />
        <property name="hibernate.id.new_generator_mappings" value="false" />
        <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />
        <property name="hibernate.cache.use_second_level_cache" value="false"/>
    </properties>
</persistence-unit>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="nbpts">
    <jta-data-source>java:/nbptsDS</jta-data-source>
    <class>com.myproject.persistence.BookletCode</class>
    <class>com.myproject.persistence.ClipData</class>
    <class>com.myproject.persistence.CronJob</class>
    <class>com.myproject.persistence.ExerciseCodePK</class>
    <class>com.myproject.persistence.ExerciseCode</class>
    <class>com.myproject.persistence.ExportFile</class>
    <class>com.myproject.persistence.Hold</class>
    <class>com.myproject.persistence.InputFile</class>
    <class>com.myproject.persistence.InputRecord</class>
    <class>com.myproject.persistence.MessageLog</class>
    <class>com.myproject.persistence.NbricCodePK</class>
    <class>com.myproject.persistence.NbricCode</class>
    <class>com.myproject.persistence.OEMappingPK</class>
    <class>com.myproject.persistence.OEMapping</class>
    <class>com.myproject.persistence.OERecord</class>
    <class>com.myproject.persistence.Parameters</class>
    <class>com.myproject.persistence.PostEditData</class>
    <class>com.myproject.persistence.PreidRecord</class>
    <class>com.myproject.persistence.ProcessLog</class>
    <class>com.myproject.persistence.Response</class>
    <class>com.myproject.persistence.Score</class>
    <class>com.myproject.persistence.SetupFilePK</class>
    <class>com.myproject.persistence.SetupFile</class>
    <class>com.myproject.persistence.SftpConfig</class>
    <class>com.myproject.persistence.TestMap</class>
    <class>com.myproject.persistence.User</class>
    <class>com.myproject.persistence.DataPrep</class>
    <properties>
        <property name="hibernate.archive.autodetection" value="class" />
        <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />

        <property name="hibernate.hbm2ddl.auto" value="validate" />

        <property name="hibernate.show_sql" value="false" />
        <property name="hibernate.format_sql" value="false" />
        <property name="hibernate.use_sql_comments" value="false" />
        <property name="hibernate.id.new_generator_mappings" value="false" />
        <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />
        <property name="hibernate.cache.use_second_level_cache" value="false"/>
    </properties>
</persistence-unit>
<persistence-unit name="nbdx">
    <jta-data-source>java:/nbdxDS</jta-data-source>
    <properties>
        <property name="hibernate.archive.autodetection" value="class" />
        <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />            
        <property name="hibernate.show_sql" value="false" />
        <property name="hibernate.format_sql" value="false" />
        <property name="hibernate.use_sql_comments" value="false" />
        <property name="hibernate.id.new_generator_mappings" value="false" />
        <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />
        <property name="hibernate.cache.use_second_level_cache" value="false"/>
    </properties>
</persistence-unit>

我指的是数据源。对于nbdx,它是nbdxDS和nbpts,它是nbptsDS,这两个DB连接具有相同的表名,称为exercise_codes。所以它会变得很困惑,并选择其他表,而不是部署war文件。

这里是错误

16:13:47,277信息[org.hibernate.tool.hbm2ddl.TableMetadata](ServerService线程池--48)HHH000261:找到表:nbdx_dev.exerforise_codes

JBAS014777:无法启动的服务:服务jboss.persistenceUnit。“nbpts.war#nbpts”:org.jboss.msc.service.StartException在服务jboss.persistenceUnit中。“nbpts.war#nbpts”:javax.persistence.persistenceException:[persistenceUnit:nbpts]无法生成EntityManagerFactory

16:13:47,733信息[org.jboss.as](控制器引导线程)JBAS015961:Http管理接口监听Http://127.0.0.1:9990/management

16:13:47,733信息[org.jboss.as](控制器引导线程)JBAS015951:Admin console Listing on http://127.0.0.1:9990

16:13:47,733错误[org.JBoss.AS](控制器引导线程)JBAS015875:JBoss EAP 6.3.0.GA(AS 7.4.0.final-redhat-19)在10702ms中启动(有错误)-启动了279个服务中的219个(20个服务失败或缺少依赖项,59个服务是惰性的、被动的或按需的)

你能帮帮我吗?

共有1个答案

贝嘉泽
2023-03-14

我回味了一下。由于某些原因,EAP没有获得正确的架构名称,因此必须在properties name hibernate.default_schema 中设置架构名称

 类似资料:
  • 问题内容: 如何有条件地添加一个元素属性,例如复选框的? 我认为以前的Angular版本具有并且似乎都提供了我所追求的功能。但是,这些属性在Angular 2中似乎不存在,我看不到提供此功能的其他方法。 问题答案: 删除它: 要么 暗示: 属性与属性 当您在其中添加此绑定的HTML元素不具有该绑定中使用的名称的属性(在这种情况下),并且也没有将Angular组件或指令应用于具有的同一元素时,则无法

  • 如何有条件地添加元素属性,例如复选框的? Angular以前的版本有< code>NgAttr和我认为< code>NgChecked,它们似乎都提供了我所追求的功能。然而,这些属性在Angular 2中似乎并不存在,我也看不出有其他方法可以提供这种功能。

  • 我有一个与docusign的开发人员帐户,能够上传一个单一的PDF文件,并签署这样。但根据我的要求,我需要在docusign内一次上传多个PDF文件,并相应地签名。我们目前使用的是docusign SOAP API,下面是示例访问URL:http://etplprojects.net/docusign_API/SOAP/这可能吗?请建议。

  • 一切都在问题中,有没有一种方法在extjs中显示€符号?我试过了 但对于欧洲货币(1)来说,它回报了我

  • 问题内容: 在网络上快速搜索发现三个或四个变种人如何被指定和在。 指定JPA 2.1版的“正确”方式是什么? 我正在使用 问题答案: 根据官方文档,它必须是(像您的一样):