With Tom and Andrei's help, I was able to cut-down the patch to affect
only 3 files:
PersistenceProvider, PersistenceInitializationHelper and
ArchiveFactoryImpl
(see https://bugs.eclipse.org/bugs/show_bug.cgi?id=292152; new
attachment obsoletes old attachment).
The issue of how this fits into JPA outside of testing is tabled for
later ...
Code reviewed by Tom Ware
---
Mike Norman wrote:
A lot of questions ... I'll try to summarize things:
- yes, this is primarily focused on testing, so I don't think users
will be installing their own custom PersistenceInitializationHelper's
(but who knows, it might be useful for them as well)
- no internal API's required, everything is public:
PersistenceProvider provider = new
org.eclipse.persistence.jpa.PersistenceProvider();
((org.eclipse.persistence.jpa.PersistenceProvider)provider).setInitializationHelper(
new DynamicPersistenceInitializationHelper());
EntityManagerFactory emf = provider.createEntityManagerFactory(
"someName", getDatabaseProperties());
- there are many examples throughout EclipseLink where - because of the
nature of test environments, DB setup, etc - tests are not 'real world'
It is not always required - or possible - to exactly reproduce 'end
user usage'
- I'll leave the issue of "alternate persistence.xml location for all
of JPA" for others to answer - I don't know what is/is not allowed by
spec or convention
|