-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Hibernate 5.1 EntityManagerFactory
PostPosted: Fri Mar 18, 2016 3:29 pm 
Newbie

Joined: Thu Dec 28, 2006 12:24 pm
Posts: 5
Location: Brazil
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();


Top
 Profile  
 
 Post subject: Re: Hibernate 5.1 EntityManagerFactory
PostPosted: Fri Mar 18, 2016 3:50 pm 
Newbie

Joined: Thu Dec 28, 2006 12:24 pm
Posts: 5
Location: Brazil
Just creating a file in META-INF/org.hibernate.boot.spi.MetadataSourcesContributor
and the content is my implementation of MetadataSourcesContributor


Top
 Profile  
 
 Post subject: Re: Hibernate 5.1 EntityManagerFactory
PostPosted: Sat Mar 19, 2016 9:03 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
We documented this in the new User Guide. You can pass in the "hibernate.integrator_provider" in the "integrationSettings" Map.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.