That's going to depend on which "bootstrap" they use. JPA defines 2 which it terms "SE" and "EE". Not sure this will work in all EE bootstrap environments, but you have:
```` PersistenceProviderResolver resolver = PersistenceProviderResolverHolder.getPersistenceProviderResolver(); List<PersistenceProvider> providers = resolver.getPersistenceProviders(); ```` On Thu, Apr 25, 2019 at 1:25 PM Guillaume Smet <[email protected]> wrote: > On Thu, Apr 25, 2019 at 8:05 PM Steve Ebersole <[email protected]> > wrote: > >> EMF + Metamodel are standard JPA contracts: >> >> ```` >> try { >> emf.getMetamodel().managedType( theClass ); >> } >> catch ( IllegalArgumentException e ) { >> // JPA defined exception if the passed class is not a managed type >> } >> >> Again, that will (should) work on any provider >> > > Thanks. > > So I was pretty sure it would work with any provider. My question was > more: how to make it work with multiple providers? Right now, the current > implementation is very low level and doesn't use anything but JPA to get > the EMF. But I didn't see any way to get all the potentially created EMF. > > I suppose I could try to get all the EMF from CDI - that would make this > feature CDI-compatible only but I suppose it's acceptable. I will probably > will need to do that after everything is initialized or I will have a > chicken and egg problem as the EMF needs to get the ValidatorFactory. The > thing is that, in this case, all the EMF should be created via CDI or it > won't work very well. > > Collecting once and for all all the managed types via > emf.getMetamodel().getManagedTypes() should work. > > @Gunnar Morling <[email protected]> does it make sense to you too? > > -- > Guillaume > > > _______________________________________________ hibernate-dev mailing list [email protected] https://lists.jboss.org/mailman/listinfo/hibernate-dev
