- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有两个 persistenceUnits 映射到两个不同的 Oracle 模式,这些模式相似但表名不同。当我尝试部署我的应用程序时,我收到一个 Hibernate 异常“Missing Table”,看起来 Hibernate 正在错误的 persistenceUnit 中寻找表。
.ear#POIPersistenceUnit\": org.hibernate.HibernateException: Missing table: POI_SERVICE Caused by: org.hibernate.HibernateException: Missing table: POI_SERVICE"}}
表“POI_SERVICE”属于“POIExtractorPersistenceUnit”persistenceUnit,而不是“POIPersistenceUnit”persistenceUnit
我尝试在 persistence.xml 文件中列出具有相应 persistenceUnits 的实体,如下所示,但没有成功,仍然遇到相同的错误。
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
<persistence-unit name="POIExtractorPersistenceUnit">
<jta-data-source>java:/XAPOIExtractorDS</jta-data-source>
<class>za.co.fnb.cii.poiextractor.persistence.model.IdentificationRequest</class>
<class>za.co.fnb.cii.poiextractor.persistence.model.IdentificationResponse</class>
<class>za.co.fnb.cii.poiextractor.persistence.model.POIService</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />
<property name="hibernate.archive.autodetection" value="class" />
<property name="hibernate.flushMode" value="FLUSH_AUTO" />
<property name="hibernate.hbm2ddl.auto" value="validate" />
<property name="hibernate.show_sql" value="true" />
</properties>
</persistence-unit>
<persistence-unit name="POIPersistenceUnit">
<jta-data-source>java:/XACompendiumDS</jta-data-source>
<class>za.co.fnb.cii.poiextractor.persistence.entities.IdentificationRequestIncoming</class>
<class>za.co.fnb.cii.poiextractor.persistence.entities.IdentificationResponseIncoming</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />
<property name="hibernate.archive.autodetection" value="class" />
<property name="hibernate.flushMode" value="FLUSH_AUTO" />
<property name="hibernate.hbm2ddl.auto" value="validate" />
<property name="hibernate.show_sql" value="false" />
</properties>
</persistence-unit>
我还尝试按如下方式注释实体 @PersistenceUnit(unitName = "POIExtractorPersistenceUnit")
但仍然没有成功,错误仍然存在。
/**
* Created by on 21-Dec-15.
*/
@Entity
@Table(name = "POI_SERVICE")
@PersistenceUnit(unitName = "POIExtractorPersistenceUnit")
@NamedQueries({
@NamedQuery(name="findServiceRecordByApplicationName",
query="SELECT pois FROM POIService pois WHERE pois.application = :applicationName")
})
public class POIService implements IEntity{
@Id
@GeneratedValue(generator="service_config_seq")
@SequenceGenerator(name="service_config_seq", sequenceName="service_config_seq", allocationSize=1)
private long id;
private String application;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "last_update",nullable = false)
private Date lastUpdate;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "last_date",nullable = true)
private Date lastDate;
@Column(name = "last_record",nullable = true)
private long lastRecord;
@Override
public long getId() {
return id;
}
public String getApplication() {
return application;
}
public void setApplication(String application) {
this.application = application;
}
public Date getLastUpdate() {
return lastUpdate;
}
public void setLastUpdate(Date lastUpdate) {
this.lastUpdate = lastUpdate;
}
public Date getLastDate() {
return lastDate;
}
public void setLastDate(Date lastDate) {
this.lastDate = lastDate;
}
public long getLastRecord() {
return lastRecord;
}
public void setLastRecord(long lastRecord) {
this.lastRecord = lastRecord;
}
}
更新:
堆栈跟踪
2016-01-08 12:24:52,587 INFO [java.sql.DatabaseMetaData] (ServerService Thread Pool -- 58) HHH000262: Table not found: POI_SERVICE 2016-01-08 12:24:52,590 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 58) MSC000001: Failed to start service jboss.persistenceunit."poiextractor-ear-1.0.0-SNAPSHOT.ear#POIPersistenceUnit": org.jboss.msc.service.StartException in service jboss.persistenceunit."poiextractor-ear-1.0.0-SNAPSHOT.ear#POIPersistenceUnit": org.hibernate.HibernateException: Missing table: POI_SERVICE at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:172) [wildfly-jpa-8.2.0.Final.jar:8.2.0.Final] at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:117) [wildfly-jpa-8.2.0.Final.jar:8.2.0.Final] at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.8.0_60] at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:474) [wildfly-security-manager-1.0.0.Final.jar:1.0.0.Final] at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:182) [wildfly-jpa-8.2.0.Final.jar:8.2.0.Final] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_60] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_60] at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_60] at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.1.1.Final.jar:2.1.1.Final] Caused by: org.hibernate.HibernateException: Missing table: POI_SERVICE at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1335) [hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:155) [hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:525) [hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1859) [hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:852) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:845) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:398) [hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:844) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final] at org.jboss.as.jpa.hibernate4.TwoPhaseBootstrapImpl.build(TwoPhaseBootstrapImpl.java:44) [jipijapa-hibernate4-3-1.0.1.Final.jar:] at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:154) [wildfly-jpa-8.2.0.Final.jar:8.2.0.Final] ... 8 more
2016-01-08 12:24:58,786 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 57) HHH000261: Table found: POIOPS.POI_SERVICE 2016-01-08 12:24:58,788 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 57) HHH000037: Columns: [last_record, application, last_update, id, last_date] 2016-01-08 12:25:00,774 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 57) HHH000261: Table found: POIOPS.IDENTIFICATION_REQUEST 2016-01-08 12:25:00,775 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 57) HHH000037: Columns: [sworkstationid, yafp2wsqimage, stransactiontime, created, stype, bretphoto, scardseqno, stranid, breturnname, smode, requesttype, ssiteid, identificationresponse_id, sidn, id, yafp1wsqimage, updated, ifpind1, ifpind2] 2016-01-08 12:25:05,385 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 57) HHH000261: Table found: POIOPS.IDENTIFICATION_RESPONSE 2016-01-08 12:25:05,387 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 57) HHH000037: Columns: [bnameret, created, sfpind2, scallcentreno, ifp2score, stranid, sidissuedate, ierror, ifp1score, sfp1result, sidn, sname, serror, sfp2result, sfpind1, yaphoto, ssmartcardind, id, ssurname, updated] 2016-01-08 12:25:09,367 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 57) HHH000261: Table found: POIOPS.IDENTIFICATIONREQUEST 2016-01-08 12:25:09,369 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 57) HHH000037: Columns: [sworkstationid, responseerror, yafp2wsqimage, stransactiontime, created, stype, bretphoto, scardseqno, stranid, breturnname, smode, requesttype, ssiteid, sidn, id, yafp1wsqimage, updated, ifpind1, ifpind2] 2016-01-08 12:25:15,851 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 57) HHH000261: Table found: POIOPS.IDENTIFICATIONRESPONSE 2016-01-08 12:25:15,853 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 57) HHH000037: Columns: [bnameret, created, sfpind2, scallcentreno, ifp2score, stranid, sidissuedate, ierror, ifp1score, sfp1result, sidn, sname, serror, sfp2result, sfpind1, yaphoto, ssmartcardind, id, ssurname, updated, request_id] 2016-01-08 12:25:15,994 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 2) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "poiextractor-ear-1.0.0-SNAPSHOT.ear")]) - failure description: {"JBAS014671: Failed services" => {"jboss.persistenceunit.\"poiextractor-ear-1.0.0-SNAPSHOT.ear#POIPersistenceUnit\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"poiextractor-ear-1.0.0-SNAPSHOT.ear#POIPersistenceUnit\": org.hibernate.HibernateException: Missing table: POI_SERVICE Caused by: org.hibernate.HibernateException: Missing table: POI_SERVICE"}} 2016-01-08 12:25:15,996 ERROR [org.jboss.as.server] (management-handler-thread - 2) JBAS015870: Deploy of deployment "poiextractor-ear-1.0.0-SNAPSHOT.ear" was rolled back with the following failure message: {"JBAS014671: Failed services" => {"jboss.persistenceunit.\"poiextractor-ear-1.0.0-SNAPSHOT.ear#POIPersistenceUnit\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"poiextractor-ear-1.0.0-SNAPSHOT.ear#POIPersistenceUnit\": org.hibernate.HibernateException: Missing table: POI_SERVICE Caused by: org.hibernate.HibernateException: Missing table: POI_SERVICE"}} 2016-01-08 12:25:15,997 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-6) JBAS010418: Stopped Driver service with driver-name = poiextractor-ear-1.0.0-SNAPSHOT.ear_org.h2.Driver_1_4 2016-01-08 12:25:15,998 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 57) JBAS011410: Stopping Persistence Unit (phase 2 of 2) Service 'poiextractor-ear-1.0.0-SNAPSHOT.ear#POIExtractorPersistenceUnit' 2016-01-08 12:25:16,018 INFO [org.jboss.weld.deployer] (MSC service thread 1-9) JBAS016009: Stopping weld service for deployment poiextractor-ear-1.0.0-SNAPSHOT.ear 2016-01-08 12:25:16,043 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 57) JBAS011410: Stopping Persistence Unit (phase 1 of 2) Service 'poiextractor-ear-1.0.0-SNAPSHOT.ear#POIPersistenceUnit' 2016-01-08 12:25:16,043 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 59) JBAS011410: Stopping Persistence Unit (phase 1 of 2) Service 'poiextractor-ear-1.0.0-SNAPSHOT.ear#POIExtractorPersistenceUnit'
更新2:当我从 persistence.xml 中删除此属性时,一切正常。
<property name="hibernate.hbm2ddl.auto" value="validate" />
最佳答案
一个 JPA EntityManager
属于一个持久性单元,或 EntityManagerFactory
,您不能将多个持久性单元与同一个 EntityManager
混合使用。
但你不必这样做。
您可以拥有单个持久性单元,并在映射实体时使用schema
属性。
如果您使用多个持久性单元,则需要多个 persistence.xml
、多个 EntityManagerFactory
,如果需要全局事务,可能还需要 JTA。
关于java - 如何将 JPA 实体与持久性单元关联,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34674618/
最近几天,我们考虑使用 Solr 作为我们的首选搜索引擎。 我们需要的大多数功能都是开箱即用的,或者可以轻松配置。 然而,我们绝对需要的一项功能似乎在 Solr 中被很好地隐藏(或缺失)了。 我会试着
我是 Sequelize 的新手,并且一直在探索关联。我正在使用 mysql 5.6 并 Sequelize ^4.42.0。我正在尝试创建两个简单的表:PRJS 和 TASKS 并将一些数据插入这些
关联、聚合和组合之间有什么区别?请从实现的角度解释一下。 最佳答案 对于两个对象,Foo 和 Bar 可以定义关系 关联 - 我与一个对象有关系。 Foo 使用 Bar public class Fo
这两种 hasOne 语法有什么区别? class Project { ....... ............ static hasOne = Employee // static h
对于当前的项目,我想使用遗传算法 - 目前我查看了 jenetics 库。 如何强制某些基因相互依赖?我想将 CSS 映射到基因上,例如我有基因指示是否显示图像,以及如果它也是各自的高度和宽度。因此,
关联、聚合和组合之间有什么区别?请从实现的角度解释一下。 最佳答案 对于两个对象,Foo 和 Bar 可以定义关系 关联 - 我与一个对象有关系。 Foo 使用 Bar public class Fo
假设我有一个名为“学生”的表格,其中包含姓名、手机、电子邮件、首选类(class)、首选学校、性别、年龄、地址、资格、职称、家庭电话、工作电话等列 我想从 Students 表中选择数据并插入到 2
问题标题有点困惑。我有一级员工和一级项目。一名或多名员工正在从事一个或多个项目。在这个关联中,我只有一个从具有*多重性的员工类到具有*多重性的项目类的链接。现在有另一种实现。每个项目只有一名经理,属于
到目前为止,我有一个程序采用一组随机点、站点,并围绕这些点形成适当的 Voronoi 图,表示为角和边的图形。它还为我提供了 Delaunay 三角剖分作为另一个以所有站点为节点的图形(尽管我不知道这
实现IComMethodEvents时你得到三个事件。 OnMethodCall OnMethodException OnMethodReturn 我的目标是记录 COM+ 组件中每个方法的调用时间。
我正在处理这个问题。我正在创造数学问题,每一个都有回应。例如。 如果我的问题是关于“5x + 15 = 2 的结果?”,我将只等待一个答案(整数)。 如果我的问题是关于“给我这个形状的面积和许可”,我
我正在寻找一种数据结构来保存唯一元素的无序集合,它将支持以下操作 在集合中任意位置插入/删除元素 查询元素是否存在 访问一个随机元素 天真地,1 和 2 建议使用关联容器,例如unordered_se
是否可以在 LINQ 中使用类似 ContactAddress.Contact 的内容,而无需在 SQL Server 中在这两者之间创建外键关系(通过 Contact.Id ContactAddr
我一直在谷歌搜索,但不明白调用 javax.persistence.criteria.Subquery 和 Criteria API 的方法相关的结果是什么。 http://www.objectdb.
我正在关注 Chris McCord 的“Programming Phoenix”一书,在第 6 章中,在 User 之间创建了一个关系。和一个 Video . 尝试使用 mix phoenix.se
我在 XAML 中有一个 ItemsControl,我在其中为每个组显示一个扩展器,以便我可以展开/折叠该组。我想保持 IsExpanded 的状态属性(以及可能与组标题显示相关的其他设置)。通常你只
Oracle 11 中是否有内置方法来检查 varchar2 字段中值的相关性?例如,给定一个简单的表,如下所示: MEAL_NUM INGREDIENT --------------------
是否可以在没有 JPA 在数据库中创建外键的情况下设置多对一关联? 这些表归另一个系统所有,并以异步方式填充。因此我们不能在数据库中使用 FK。仍然,几乎总是,最终是一种关系。 @ManyToOne(
我一直在使用NHibernate,使用Fluent NHibernate进行映射。我解决了很多问题,并开始认为自己在nhibernate中经验丰富。 但是,此错误非常奇怪。 这是我的模型: p
我正在开发一个 Typescript Sequelize 项目,其中我的 /models/index.ts 文件具有以下“导入此目录中的所有模型”功能: var basename = path.bas
我是一名优秀的程序员,十分优秀!