I am trying to programmatically override the Hibernate config file setting in persistence.xml by passing in a Properties object to Persistence.createEntityManagerFactory. In that Properties object, I set the “hibernate.ejb.cfgfile” property.
When I do, I get an UnsupportedOperationException down in org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.mergeSettings().
It looks like line 483 (I am using version 5.4.0.Final) in that file is trying to remove the CFG_FILE property from an unmodifiable map that was created back on line 78 of org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilderOrNull() by a call to wrap.
Hibernate 5.4.0, Oracle JDK 10.0.2, MacOS, MySQL 5.7