JPA 1.0 错误:名称不是可识别的实体或标识符。已知实体名称:[]

发布于 2024-09-27 02:36:45 字数 4588 浏览 6 评论 0原文

当我尝试执行简单的 JPA 1.0 代码时,出现以下异常。 可能是什么原因?

5453  DevPQRWDPBSSPersist  WARN   [P=351601:O=0:CT] openjpa.Enhance - This configuration disallows runtime optimization, but the following listed types were not enhanced at build time or at class load time with a javaagent: "[class com.XYZ.PQR.bss.client.db.data.markerentry, class com.XYZ.PQR.bss.client.db.data.Serviceproduct, class com.XYZ.PQR.bss.client.db.data.Agreementterms, class com.XYZ.PQR.bss.client.db.data.Offeringattribute, class com.XYZ.PQR.bss.client.db.data.marker, class com.XYZ.PQR.bss.client.db.data.OfferingpriceadjustmentrelPK, class com.XYZ.PQR.bss.client.db.data.Serviceoffering, class com.XYZ.PQR.bss.client.db.data.Offeringassociation, class com.XYZ.PQR.bss.client.db.data.OfferingpriceserviceofferingrelPK, class com.XYZ.PQR.bss.client.db.data.Offer, class com.XYZ.PQR.bss.client.db.data.Offeringpriceadjustmentrel, class com.XYZ.PQR.bss.client.db.data.Offeringfamily, class com.XYZ.PQR.bss.client.db.data.Offeringpriceserviceofferingrel, class com.XYZ.PQR.bss.client.db.data.Serviceproductattribute, class com.XYZ.PQR.bss.client.db.data.Offeringprice, class com.XYZ.PQR.bss.client.db.data.Agreement]".
6563  DevPQRWDPBSSPersist  TRACE  [P=351601:O=0:CT] openjpa.jdbc.SQL - <t 1183336072, conn 944453707> executing prepstmnt 152307988 SELECT so.* from DB2INST1.SERVICEOFFERING so where so.ISDELETED = 0 and so.id in (select oa.SERVICEOFFERINGID from DB2INST1.OFFERINGATTRIBUTE oa where oa.SERVICEOFFERINGID = so.id AND oa.name = ? and oa.STRINGVALUE = ? and oa.ISDELETED = 0) [params=(String) productbundleid, (String) attrValue]
7281  DevPQRWDPBSSPersist  TRACE  [P=351601:O=0:CT] openjpa.jdbc.SQL - <t 1183336072, conn 944453707> [718 ms] spent
Exception in thread "P=351601:O=0:CT" <openjpa-1.2.1-SNAPSHOT-r422266:686069 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter "SELECT OBJECT(attr) FROM Offeringattribute attr WHERE attr.serviceofferingid IN (:OfferingIds) AND attr.isdeleted = 0". Error message: The name "Offeringattribute" is not a recognized entity or identifier. Known entity names: []
 at org.apache.openjpa.kernel.exps.AbstractExpressionBuilder.parseException(AbstractExpressionBuilder.java:118)
 at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getClassMetaData(JPQLExpressionBuilder.java:180)
 at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.resolveClassMetaData(JPQLExpressionBuilder.java:150)
 at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java:225)
 at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java:195)
 at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateType(JPQLExpressionBuilder.java:188)
 at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.access$600(JPQLExpressionBuilder.java:69)
 at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.populate(JPQLExpressionBuilder.java:1756)
 at org.apache.openjpa.kernel.jpql.JPQLParser.populate(JPQLParser.java:56)
 at org.apache.openjpa.kernel.ExpressionStoreQuery.populateFromCompilation(ExpressionStoreQuery.java:153)
 at org.apache.openjpa.kernel.QueryImpl.newCompilation(QueryImpl.java:658)
 at org.apache.openjpa.kernel.QueryImpl.compilationFromCache(QueryImpl.java:639)
 at org.apache.openjpa.kernel.QueryImpl.compileForCompilation(QueryImpl.java:605)
 at org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:667)
 at org.apache.openjpa.kernel.QueryImpl.getOperation(QueryImpl.java:1492)
 at org.apache.openjpa.kernel.DelegatingQuery.getOperation(DelegatingQuery.java:123)
 at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:243)
 at org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:293)
 at com.XYZ.PQR.bss.client.offering.impl.OfferingServiceImpl.getOfferingsByStringAttribute(OfferingServiceImpl.java:661)
 at com.XYZ.PQR.bss.marker.impl.testAks.testAPI(testAks.java:38)
 at com.XYZ.PQR.bss.marker.impl.testAks.main(testAks.java:24)

    <properties>

<property name="openjpa.ConnectionDriverName" value="com.XYZ.db2.jcc.DB2Driver"/>
   <property name="openjpa.ConnectionURL" value="jdbc:db2://xyz.com:50000/ABC"/>
   <property name="openjpa.ConnectionUserName" value="usr"/>
   <property name="openjpa.ConnectionPassword" value="pwd"/>
   <property name="openjpa.jdbc.Schema" value="sch123"/>
    <property name="openjpa.Log" value="SQL=TRACE" />

</properties>

I am getting following exception while I try to execute simple JPA 1.0 code.
What may be the cause?

5453  DevPQRWDPBSSPersist  WARN   [P=351601:O=0:CT] openjpa.Enhance - This configuration disallows runtime optimization, but the following listed types were not enhanced at build time or at class load time with a javaagent: "[class com.XYZ.PQR.bss.client.db.data.markerentry, class com.XYZ.PQR.bss.client.db.data.Serviceproduct, class com.XYZ.PQR.bss.client.db.data.Agreementterms, class com.XYZ.PQR.bss.client.db.data.Offeringattribute, class com.XYZ.PQR.bss.client.db.data.marker, class com.XYZ.PQR.bss.client.db.data.OfferingpriceadjustmentrelPK, class com.XYZ.PQR.bss.client.db.data.Serviceoffering, class com.XYZ.PQR.bss.client.db.data.Offeringassociation, class com.XYZ.PQR.bss.client.db.data.OfferingpriceserviceofferingrelPK, class com.XYZ.PQR.bss.client.db.data.Offer, class com.XYZ.PQR.bss.client.db.data.Offeringpriceadjustmentrel, class com.XYZ.PQR.bss.client.db.data.Offeringfamily, class com.XYZ.PQR.bss.client.db.data.Offeringpriceserviceofferingrel, class com.XYZ.PQR.bss.client.db.data.Serviceproductattribute, class com.XYZ.PQR.bss.client.db.data.Offeringprice, class com.XYZ.PQR.bss.client.db.data.Agreement]".
6563  DevPQRWDPBSSPersist  TRACE  [P=351601:O=0:CT] openjpa.jdbc.SQL - <t 1183336072, conn 944453707> executing prepstmnt 152307988 SELECT so.* from DB2INST1.SERVICEOFFERING so where so.ISDELETED = 0 and so.id in (select oa.SERVICEOFFERINGID from DB2INST1.OFFERINGATTRIBUTE oa where oa.SERVICEOFFERINGID = so.id AND oa.name = ? and oa.STRINGVALUE = ? and oa.ISDELETED = 0) [params=(String) productbundleid, (String) attrValue]
7281  DevPQRWDPBSSPersist  TRACE  [P=351601:O=0:CT] openjpa.jdbc.SQL - <t 1183336072, conn 944453707> [718 ms] spent
Exception in thread "P=351601:O=0:CT" <openjpa-1.2.1-SNAPSHOT-r422266:686069 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter "SELECT OBJECT(attr) FROM Offeringattribute attr WHERE attr.serviceofferingid IN (:OfferingIds) AND attr.isdeleted = 0". Error message: The name "Offeringattribute" is not a recognized entity or identifier. Known entity names: []
 at org.apache.openjpa.kernel.exps.AbstractExpressionBuilder.parseException(AbstractExpressionBuilder.java:118)
 at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getClassMetaData(JPQLExpressionBuilder.java:180)
 at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.resolveClassMetaData(JPQLExpressionBuilder.java:150)
 at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java:225)
 at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java:195)
 at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateType(JPQLExpressionBuilder.java:188)
 at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.access$600(JPQLExpressionBuilder.java:69)
 at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.populate(JPQLExpressionBuilder.java:1756)
 at org.apache.openjpa.kernel.jpql.JPQLParser.populate(JPQLParser.java:56)
 at org.apache.openjpa.kernel.ExpressionStoreQuery.populateFromCompilation(ExpressionStoreQuery.java:153)
 at org.apache.openjpa.kernel.QueryImpl.newCompilation(QueryImpl.java:658)
 at org.apache.openjpa.kernel.QueryImpl.compilationFromCache(QueryImpl.java:639)
 at org.apache.openjpa.kernel.QueryImpl.compileForCompilation(QueryImpl.java:605)
 at org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:667)
 at org.apache.openjpa.kernel.QueryImpl.getOperation(QueryImpl.java:1492)
 at org.apache.openjpa.kernel.DelegatingQuery.getOperation(DelegatingQuery.java:123)
 at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:243)
 at org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:293)
 at com.XYZ.PQR.bss.client.offering.impl.OfferingServiceImpl.getOfferingsByStringAttribute(OfferingServiceImpl.java:661)
 at com.XYZ.PQR.bss.marker.impl.testAks.testAPI(testAks.java:38)
 at com.XYZ.PQR.bss.marker.impl.testAks.main(testAks.java:24)

    <properties>

<property name="openjpa.ConnectionDriverName" value="com.XYZ.db2.jcc.DB2Driver"/>
   <property name="openjpa.ConnectionURL" value="jdbc:db2://xyz.com:50000/ABC"/>
   <property name="openjpa.ConnectionUserName" value="usr"/>
   <property name="openjpa.ConnectionPassword" value="pwd"/>
   <property name="openjpa.jdbc.Schema" value="sch123"/>
    <property name="openjpa.Log" value="SQL=TRACE" />

</properties>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

梦忆晨望 2024-10-04 02:36:45

跟踪的第一行警告您,您的实体未在构建时或类加载时使用 javaagent 进行增强

虽然我的理解是运行增强器并不是严格要求的,但跟踪的以下部分仍然暗示 OpenJPA 不知道任何实体

错误消息:名称“Offeringattribute”不是可识别的实体或标识符。已知实体名称:[]

看起来好像出了问题和/或 OpenJPA 没有使用任何 后备机制。在日志中查找先前的警告。或者设置构建时间增强。

以下资源可能会有所帮助:

The first line of the trace warns you that your entities were not enhanced at build time or at class load time with a javaagent.

And while my understanding is that running the enhancer is not is not strictly required, the following part of the trace is still an hint that OpenJPA is not aware of any entity:

Error message: The name "Offeringattribute" is not a recognized entity or identifier. Known entity names: []

It looks like that something went wrong and/or that OpenJPA didn't use any of the fallback mechanisms. Look for a previous warning in the logs. Or setup build time enhancement.

The following resources might help:

戴着白色围巾的女孩 2024-10-04 02:36:45

仔细阅读此内容 http://openjpa.apache.org/build-and-runtime -dependency.html

如果您的项目是独立应用程序,则必须将 geronimo-* 库添加到您的项目中。

Read this very carefuly http://openjpa.apache.org/build-and-runtime-dependencies.html

You have to add geronimo-* libraries to Your project, if it is stand-alone application.

森林很绿却致人迷途 2024-10-04 02:36:45

我在使用旧版 JPA 1.0 Web 应用程序时间歇性地遇到此问题。这是由于实体增强之前发生的请求。

如果仍然卡在 JPA 1.0 应用程序上并且间歇性地遇到此问题,请尝试将以下内容添加到 persistence.xml

来自 Open JPA 文档,第 6.2 章:元数据存储库

预加载:布尔属性。如果为 true,OpenJPA 将立即加载
EntityManagerFactory 创建的存储库。结果,所有实体
类将被 JVM 急切地加载。一旦元数据预加载
完成后,所有锁定都会从 MetaDataRepository 中删除,并且此
将产生一个更具可扩展性的存储库。如果为假,则
当实体类被加载时,存储库将被延迟加载
JVM。默认值为 false。

此选项在 openjpa-1.2.1 (2009) 中不可用,但在 openjpa-1.2.3 发布时 (2013) 引入。

I was encountering this problem intermittently with a legacy JPA 1.0 web application. It was due to requests occurring to prior to Entity Enhancement.

If any is still stuck with a JPA 1.0 application and is encountering this problem intermittently, try adding the following to persistence.xml:

<property name="openjpa.MetaDataRepository" value="Preload=true" />

From Open JPA Documentation, Chapter 6.2: Metadata Repository:

Preload: A boolean property. If true, OpenJPA will eagerly load the
repository on EntityManagerFactory creation. As a result, all Entity
classes will be eagerly loaded by the JVM. Once MetaData preloading
completes, all locking is removed from the MetaDataRepository and this
will result in a much more scalable repository. If false, the
repository will be lazily loaded as Entity classes are loaded by the
JVM. The default value is false.

This option was not available with openjpa-1.2.1 (2009), but was introduced by the time openjpa-1.2.3 was released (2013).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文