JPA 1.0 error: the name is not a recognized entity or identifier. Known object names: []

I get the following exception when I try to execute simple JPA 1.0 code. What could be the reason?

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> 
+4
source share
3 answers

The first line of the trace warns you that your objects were not expanded at build time or during class loading using javaagent.

And although my understanding is that launching an enhancer is not strictly required, the next part of the trace is still a hint that OpenJPA is not aware of any entity :

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

It seems that something went wrong and / or that OpenJPA did not use any backup mechanisms . Look for a previous warning in the logs. Or set the rise time of the build time.

The following resources may help:

+4
source

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

You must add geronimo- * libraries to your project if it is a standalone application.

0
source

I ran into this problem intermittently with the deprecated JPA 1.0 web application. This was due to requests made prior to Entity improvements.

If any file is still stuck in the JPA 1.0 application and occasionally encounters this problem, try adding the following to persistence.xml :

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

From JPA Public Documentation, Chapter 6.2: Metadata Repository :

Preload : boolean property. If true, OpenJPA would look forward to loading the repository on EntityManagerFactory. As a result, all entity classes will be eagerly loaded by the JVM. After the preload, MetaData is completed, the entire lock is removed from the MetaDataRepository, and this will lead to a significantly 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 since openjpa-1.2.1 (2009), but was introduced by the time openjpa-1.2.3 (2013) was released.

0
source

All Articles