创建一个JPA提供程序 [英] Creating a JPA Provider
问题描述
有人知道如何创建自己的JPA提供程序吗?我当时正在考虑制作一个可以与我们使用的SOAP Web服务接口的自定义JPA提供程序.但是,我似乎找不到任何描述如何创建自己的JPA提供程序的文档.我应该从哪里开始寻找?
Does anyone know how to create your own JPA provider? I was considering making a custom JPA provider that could interface with a SOAP webservice we use. However, I can't seem to find any document describing how to create your own JPA provider. Where should I start looking?
推荐答案
You start by implementing javax.persistence.spi.PersistenceProvider
interface and specifying your implementation using provider
element within persistence unit declaration:
<persistence-unit name="myUnit">
<provider>com.mypackage.CustomPersistenceProvider</provider>
...
</persistence-unit>
这为您提供了创建自己的EntityManagerFactory
以及因此创建EntityManager的入口点.
That gives you an entry point for creating your own EntityManagerFactory
and, consequently, EntityManager.
这里的$ 64,000问题是为什么您要做这样的事情?如果这与您的使用SOAP的惰性Hibernate JPA 问题有关,则可能不是正确的方法.
The $64,000 question here, though, is why you would want to do something like this? If this is related to your Lazy Hibernate JPA using SOAP question then this is probably not the right approach to take.
这篇关于创建一个JPA提供程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!