@Factory public class EntityManagerFactoryBean extends Object
EntityManagerFactory
.Constructor and Description |
---|
EntityManagerFactoryBean(JpaConfiguration jpaConfiguration,
io.micronaut.context.env.Environment environment,
io.micronaut.context.BeanLocator beanLocator) |
public EntityManagerFactoryBean(JpaConfiguration jpaConfiguration, io.micronaut.context.env.Environment environment, io.micronaut.context.BeanLocator beanLocator)
jpaConfiguration
- The JPA configurationenvironment
- The environmentbeanLocator
- The bean locator@Inject public void setHibernateInterceptor(@Nullable Interceptor hibernateInterceptor)
Interceptor
to use.hibernateInterceptor
- The hibernate interceptor@EachBean(value=javax.sql.DataSource.class) protected StandardServiceRegistry hibernateStandardServiceRegistry(@Parameter String dataSourceName, DataSource dataSource)
StandardServiceRegistry
bean for the given DataSource
.dataSourceName
- The data source namedataSource
- The data sourceStandardServiceRegistry
@EachBean(value=org.hibernate.boot.registry.StandardServiceRegistry.class) @RequiresHibernateEntities protected MetadataSources hibernateMetadataSources(@Parameter JpaConfiguration jpaConfiguration, StandardServiceRegistry standardServiceRegistry)
MetadataSources
for the given StandardServiceRegistry
.jpaConfiguration
- The JPA configurationstandardServiceRegistry
- The standard service registryMetadataSources
@EachBean(value=org.hibernate.boot.MetadataSources.class) @Requires(beans=org.hibernate.boot.MetadataSources.class) protected SessionFactoryBuilder hibernateSessionFactoryBuilder(MetadataSources metadataSources, @Nullable ValidatorFactory validatorFactory)
SessionFactoryBuilder
to use.metadataSources
- The MetadataSources
validatorFactory
- The ValidatorFactory
SessionFactoryBuilder
@Context @Requires(beans=org.hibernate.boot.SessionFactoryBuilder.class) @Bean(preDestroy="close") @EachBean(value=org.hibernate.boot.SessionFactoryBuilder.class) protected SessionFactory hibernateSessionFactory(SessionFactoryBuilder sessionFactoryBuilder)
SessionFactory
from the builder.sessionFactoryBuilder
- The SessionFactoryBuilder
SessionFactory
@EachBean(value=org.hibernate.SessionFactory.class) @CurrentSession protected Session currentSession(@Parameter String dataSource, SessionFactory sessionFactory)
sessionFactory
- The session factorydataSource
- The name of the data source.protected MetadataSources createMetadataSources(@Nonnull StandardServiceRegistry serviceRegistry)
MetadataSources
for the given registry.serviceRegistry
- The registry