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

隐身守侯 提交于 2019-12-05 13:41:19
Pascal Thivent

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:

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.

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).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!