I am trying to create my EntityManagerFactory manuality.
Then I need to addAnnotatedClass to start it, but i cannot use Integrator to do it anymore.
I have create a class extends MetadataSourcesContributor, in this class I start to addAnnotated class, but I dont know how to do for Hibernate read this class.
Code:
PersistenceUnitDescriptor puid = null;
List<ParsedPersistenceXmlDescriptor> load = PersistenceXmlParser.locatePersistenceUnits(GesplanProducer.loadProperties());
puid = load.stream().filter(xml -> xml.getName().equals("wizfee")).findFirst().get();
Map<String, Object> integrator = new HashMap<>();
integrator.put(EntityManagerFactoryBuilderImpl.INTEGRATOR_PROVIDER, new IntegratorProvider() {
@Override
public List<Integrator> getIntegrators() {
List<Integrator> list = new ArrayList<>();
list.add(new GesplanIntegrator());
return list;
}
});
EntityManagerFactoryBuilderImpl emfBuild = new EntityManagerFactoryBuilderImpl(puid, integrator, currentClasLoader);
emf = emfBuild.build();