如何为 Glassfish 编写持久性提供程序
我有一个特殊的数据存储(Empire RDF),我想在我的应用程序中使用 CMT 已启用。
为此,我想我必须编写 PersistenceProvider
,然后我将在 persistence.xml 中声明它,并带有 jta 数据源和关联的连接属性。
因此,我尝试这样做,但我总是面临与 PersistenceUnitLoader#loadPU (主要是,在我无知的眼中,Glassfish 将我的 PersistenceProvider 与 (Top/Eclipse)Link one 混淆了)。
那么,为非标准(与 RDBMS 无关)JPA 实现创建 Glassfish PersistenceProvider 的推荐方法是什么?
I have a special data storage (Empire RDF) I would like to use in my application with CMT enabled.
For that, I imagine I have to write a PersistenceProvider
, that I will then declare in a persistence.xml, with a jta-datasource and associated connection properties.
As a consequence, I tried to, but I always face deployment issues related to PersistenceUnitLoader#loadPU (mainly the fact that it seems - to my ignorant eyes - that Glassfish confuses my PersistenceProvider with (Top/Eclipse)Link one).
So, what is the recommended way to create a PersistenceProvider for Glassfish for a non standard (read non related to a RDBMS) JPA implementation ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
编写 PersistenceProvider 实际上是一项相当先进的任务。
PersistenceProvider
界面。就我而言,它是 EmpireJPAPersistenceProvider
。不要忘记,您可以通过persistenceUnitInfos.getProperties()
使用从persistence.xml
读取的属性,但只能在PersistenceProvider#createContainerEntityManagerFactory
方法!persistence.xml
中,写入Writing a PersistenceProvider is in fact a quite stepforward task.
PersistenceProvider
interface. In my case, it was a subclass of EmpireJPAPersistenceProvider
. Do not forget you can use properties read frompersistence.xml
usingpersistenceUnitInfos.getProperties()
, but only in thePersistenceProvider#createContainerEntityManagerFactory
method !persistence.xml
, write<provider>mycompany.MyProvider</provider>