我正在尝试创建自定义持久性提供程序类而不是openjpa.PersistenceProviderImpl
。因此,我将MyProvider
类添加到persistence.xml
。
但是它提供了一个警告日志
INFO: Found persistence provider "org.juddi.test.persistance.JUDDIPersistenceProviderImpl". OpenJPA will not be used.
我查看了openjpa
代码。它在#isOpenJPAPersistenceProvider()
方法失败,它将MyProvider
评估为未知提供程序。为了验证这一点,我只是复制粘贴了org.apache.juddi.persistence.PersistenceProviderImpl
中的全班内容并进行了检查。
public class MyProviderImpl implements PersistenceProvider, ProviderUtil
它在Persistence.createEntityManagerFactory(persistenceUnitName);
说
javax.persistence.PersistenceException: No persistence providers available for "juddiDatabase" after trying the following discovered implementations: org.apache.openjpa.osgi.OSGiPersistenceProviderImpl
是否有人尝试在 OpenJPA 中使用自定义提供程序?