没有persistence.xml的eclipselink [英] eclipselink without persistence.xml

查看:121
本文介绍了没有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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆