JPA 1.0错误:该名称不是公认的实体或标识符。已知实体名称:[] [英] JPA 1.0 error: The name is not a recognized entity or identifier. Known entity names: []

查看:230
本文介绍了JPA 1.0错误:该名称不是公认的实体或标识符。已知实体名称:[]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试执行简单的JPA 1.0代码时遇到异常。
可能是什么原因?

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>


推荐答案

跟踪的第一行警告您实体使用javaagent 时,在构建时或类加载时没有得到增强。

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.

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

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:


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

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

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

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:


  • < a href =http://openjpa.apache.org/entity-enhancement.html =nofollow>实体增强

  • OpenJPA用户指南
    • Entity Enhancement
    • OpenJPA User's Guide
      • Section 2. Enhancement

      这篇关于JPA 1.0错误:该名称不是公认的实体或标识符。已知实体名称:[]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆