Can I pass some properties to EntityManagerFactory by code, while maintaining persistence.xml as the main configuration source? Using createEntityManager overloads using Map looks completely overriding persistence.xml :
Map<String, String> propertyMap; factory.createEntityManager(propertyMap);
I would like to configure JPA in persistence.xml , but pass to the user connection string. I use HSQL, and I would like to make my own path to the DB file with the current user directory, which I need to get by the code (as far as I know).
It would be great if I could save persistence.xml anyway, since I would not have to write a custom configuration mechanism.
source share