Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

eclipselink without persistence.xml

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?

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.

like image 381
nexus Avatar asked Apr 24 '26 00:04

nexus


1 Answers

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

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.

like image 104
James Avatar answered Apr 30 '26 12:04

James