Can I pass some properties to an EntityManagerFactory by code, while still maintaining persistence.xml as the main configuration source? Using createEntityManager‘s overload with a Map appears to override persistence.xml completely:
Map<String, String> propertyMap;
factory.createEntityManager(propertyMap);
I’d like to configure JPA in persistence.xml, but pass in a custom connection string. I’m using HSQL and I’d like to compose a custom DB-file path with the current user directory, which I have to get by code (as far as I know).
It would be great if I could keep persistence.xml anyway, as I’d not have to write a custom configuration mechanism.
You mean
unless of course you mean you have created the EMF first and want to apply props after that?