我不是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
发布评论