Search in sources :

Example 16 with EntityManagerFactoryBuilderImpl

use of org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl in project jbosstools-hibernate by jbosstools.

the class JpaConfiguration method initialize.

void initialize() {
    EntityManagerFactoryBuilderImpl entityManagerFactoryBuilder = HibernateToolsPersistenceProvider.createEntityManagerFactoryBuilder(persistenceUnit, getProperties());
    EntityManagerFactory entityManagerFactory = entityManagerFactoryBuilder.build();
    sessionFactory = (SessionFactory) entityManagerFactory;
    metadata = entityManagerFactoryBuilder.getMetadata();
    getProperties().putAll(entityManagerFactory.getProperties());
}
Also used : EntityManagerFactoryBuilderImpl(org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl) EntityManagerFactory(javax.persistence.EntityManagerFactory)

Example 17 with EntityManagerFactoryBuilderImpl

use of org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl in project jbosstools-hibernate by jbosstools.

the class JPAConfiguration method getMetadata.

public Metadata getMetadata() {
    if (metadata == null) {
        EntityManagerFactoryBuilderImpl entityManagerFactoryBuilder = HibernateToolsPersistenceProvider.createEntityManagerFactoryBuilder(persistenceUnit, getProperties());
        EntityManagerFactory entityManagerFactory = entityManagerFactoryBuilder.build();
        metadata = entityManagerFactoryBuilder.getMetadata();
        getProperties().putAll(entityManagerFactory.getProperties());
    }
    return metadata;
}
Also used : EntityManagerFactoryBuilderImpl(org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl) EntityManagerFactory(javax.persistence.EntityManagerFactory)

Example 18 with EntityManagerFactoryBuilderImpl

use of org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl in project jbosstools-hibernate by jbosstools.

the class JPAConfiguration method getMetadata.

public Metadata getMetadata() {
    if (metadata == null) {
        EntityManagerFactoryBuilderImpl entityManagerFactoryBuilder = HibernateToolsPersistenceProvider.createEntityManagerFactoryBuilder(persistenceUnit, getProperties());
        EntityManagerFactory entityManagerFactory = entityManagerFactoryBuilder.build();
        metadata = entityManagerFactoryBuilder.getMetadata();
        getProperties().putAll(entityManagerFactory.getProperties());
    }
    return metadata;
}
Also used : EntityManagerFactoryBuilderImpl(org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl) EntityManagerFactory(javax.persistence.EntityManagerFactory)

Example 19 with EntityManagerFactoryBuilderImpl

use of org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl in project jbosstools-hibernate by jbosstools.

the class HibernateToolsPersistenceProviderTest method testCreateEntityManagerFactoryBuilder.

@Test
public void testCreateEntityManagerFactoryBuilder() {
    Properties properties = new Properties();
    properties.put("foo", "bar");
    assertNull(HibernateToolsPersistenceProvider.createEntityManagerFactoryBuilder("barfoo", properties));
    EntityManagerFactoryBuilderImpl entityManagerFactoryBuilder = HibernateToolsPersistenceProvider.createEntityManagerFactoryBuilder("foobar", properties);
    assertNotNull(entityManagerFactoryBuilder);
    assertEquals("bar", entityManagerFactoryBuilder.getConfigurationValues().get("foo"));
}
Also used : EntityManagerFactoryBuilderImpl(org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl) Properties(java.util.Properties) Test(org.junit.jupiter.api.Test)

Example 20 with EntityManagerFactoryBuilderImpl

use of org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl in project jbosstools-hibernate by jbosstools.

the class JpaConfiguration method initialize.

void initialize() {
    EntityManagerFactoryBuilderImpl entityManagerFactoryBuilder = HibernateToolsPersistenceProvider.createEntityManagerFactoryBuilder(persistenceUnit, getProperties());
    EntityManagerFactory entityManagerFactory = entityManagerFactoryBuilder.build();
    sessionFactory = (SessionFactory) entityManagerFactory;
    metadata = entityManagerFactoryBuilder.getMetadata();
    getProperties().putAll(entityManagerFactory.getProperties());
}
Also used : EntityManagerFactoryBuilderImpl(org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl) EntityManagerFactory(jakarta.persistence.EntityManagerFactory)

Aggregations

EntityManagerFactoryBuilderImpl (org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl)21 EntityManagerFactory (javax.persistence.EntityManagerFactory)9 Properties (java.util.Properties)6 Test (org.junit.jupiter.api.Test)5 HashMap (java.util.HashMap)3 PersistenceUnitInfoDescriptor (org.hibernate.jpa.boot.internal.PersistenceUnitInfoDescriptor)3 PersistenceUnitInfoAdapter (org.hibernate.jpa.test.PersistenceUnitInfoAdapter)3 Test (org.junit.Test)3 PersistenceDescriptorFactory (com.robo4j.db.sql.jpa.PersistenceDescriptorFactory)1 EntityManagerFactory (jakarta.persistence.EntityManagerFactory)1 PersistenceUnitInfo (jakarta.persistence.spi.PersistenceUnitInfo)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 PersistenceUnitInfo (javax.persistence.spi.PersistenceUnitInfo)1 lombok.val (lombok.val)1 EntityManagerFactoryBuilder (org.hibernate.jpa.boot.spi.EntityManagerFactoryBuilder)1 PersistenceUnitDescriptor (org.hibernate.jpa.boot.spi.PersistenceUnitDescriptor)1 SmartPersistenceUnitInfo (org.springframework.orm.jpa.persistenceunit.SmartPersistenceUnitInfo)1