没有persistence.xml的eclipselink

编程入门 行业动态 更新时间:2024-10-22 16:33:41
本文介绍了没有persistence.xml的eclipselink的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我不是XML文件的忠实拥护者。 因此,我想知道是否有一种方法可以在没有其persistence.xml配置文件的情况下使用eclipselink。为什么?

I'm not a big fan of XML files. Therefore I'm wondering if there is a way to use eclipselink without its persistence.xml configuration file. Why?

因为我要管理动态地访问不同的数据库。没有XML文件,这样做会容易得多。

Because I want to manage different databases dynamically. It would be much easier to do it without the XML file.

我很惊讶我现在无法在网上找到任何东西。

I'm surprised that I couldn't find anything on the web for now.

推荐答案

不是,但是您可以直接创建EclipseLink ServerSession并用EntityManagerFactoryImpl包装它,但我不建议这样做。

Not really, but you could create an EclipseLink ServerSession directly and wrap it with an EntityManagerFactoryImpl, but I would not suggest it.

您最好创建一个persistence.xml。您仍然可以做动态数据库,只需要传递一个包含数据库信息的属性文件到createEntityManagerFactory(Map)。

You would be better off creating a persistence.xml. You can still do dynamic databases, you just need to pass a properties file to createEntityManagerFactory(Map) that include your database info.

更多推荐

没有persistence.xml的eclipselink

本文发布于:2023-10-25 14:05:51,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1527174.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:persistence   xml   eclipselink

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!