Given this peristence.xml:
This should work to overwrite the jta-data-source.
But instead, it crashes in JSE and unit tests because it tries to resolve "java:jboss/datasources/ExampleDS" from JNDI. The `javax.persistence.jdbc.url` should overwrite the jta-data-source entry.
Even adding this doesn't fix it:
In Eclipse Link it's apparently possible to overwrite the persistence.xml's <jta-data-source> element: https://stackoverflow.com/a/20819336/472109
In Hibernate, that approach doesn't work: https://stackoverflow.com/questions/51514433/jpa-reuse-persistence-xml-with-jta-data-source-in-jse-and-junit-by-overriding-t
Actually, nm. I was simultaneously working another issue regarding what `EMF#getProperties`returns. You mean that a DriverManager-based Connection provider should be used here. That’s true.
It looks like this fix caused a failure in an EAP JPA test:
That test uses a persistence.xml containing just the following property:
<property name="hibernate.ejb.cfgfile" value="hibernate.cfg.xml"/>
hibernate.cfg.xml contains the properties that are needed for the test.
When the test calls EntityManager.getEntityManagerFactory().getProperties(), null is returned, causing an NPE when the test checks the value of a property defined in hibernate.cfg.xml,
Works for me, unless I missed something in your description. I added 2 new tests.
testCfgXmlBaseline seems to be what you describe. But it passes.
, thanks for creating the new tests. I’ll have to look into this further on Monday.
Fixed in 5.3 branch as well.