Search code examples
javajpapersistencepersistence.xmlpersistence-unit

JPA persistence unit into file?


I use JPA to persist my data to a MySQL database and it all works pretty fine. Now I need to store a couple of configurations on the system the program is executed from.

In past I would have created a settings.ini or a settings.xml file and pretty much stored my stuff into it manually. But now I am asking myself whether it is possible to create a second persistence unit in the persistence.xml which would enable me to store my data into an xml-file.

Is that possible? Can I create a persistence unit that puts my data in an xml file instead of a database?


Solution

  • Thanks to @MelaukiMawi! The right way would be to create and manage an XML file with XPath and XQuery.