Package org.hibernate.ejb

Examples of org.hibernate.ejb.HibernateEntityManagerFactory


        Statistics stats = null;
        PersistenceUnitService persistenceUnitService = registry.getPersistenceUnitService(persistenceUnitName);
        if (persistenceUnitService != null) {
            final EntityManagerFactory entityManagerFactory = persistenceUnitService.getEntityManagerFactory();
            // TODO:  with JPA 2.1, if unwrap is added to EMF, change cast to "entityManagerFactory.unwrap(HibernateEntityManagerFactory.class)"
            HibernateEntityManagerFactory entityManagerFactoryImpl = (HibernateEntityManagerFactory) entityManagerFactory;
            SessionFactory sessionFactory = entityManagerFactoryImpl.getSessionFactory();
            if (sessionFactory != null) {
                stats = sessionFactory.getStatistics();
                return new ManagementLookup(stats, entityManagerFactory);
            }
        }
View Full Code Here


   */
  public void doWork(DsWork work) {
    // Flush the EntityManager to make sure we have all entities available
    //this.em.flush();
       
    HibernateEntityManagerFactory factory = (HibernateEntityManagerFactory) this.em.unwrap(EntityManagerImpl.class).getEntityManagerFactory();
    SessionFactoryImpl sessionFactory = (SessionFactoryImpl) factory.getSessionFactory();
   
    ConnectionProvider connProvider = sessionFactory.getConnectionProvider();
    DataSource ds = null;
    if (connProvider instanceof DatasourceConnectionProviderImpl) {
      ds = ((DatasourceConnectionProviderImpl) connProvider).getDataSource();
View Full Code Here

     * @param inj
     */
    private void insertValidationEventListeners(Injector inj) {
        Provider<EntityManagerFactory> emfProvider =
            inj.getProvider(EntityManagerFactory.class);
        HibernateEntityManagerFactory hibernateEntityManagerFactory =
            (HibernateEntityManagerFactory) emfProvider.get();
        SessionFactoryImpl sessionFactoryImpl =
            (SessionFactoryImpl) hibernateEntityManagerFactory.getSessionFactory();
        EventListenerRegistry registry =
            sessionFactoryImpl.getServiceRegistry().getService(EventListenerRegistry.class);

        Provider<BeanValidationEventListener> listenerProvider =
            inj.getProvider(BeanValidationEventListener.class);
View Full Code Here

     * @param injector
     */
    private void insertValidationEventListeners(Injector injector) {
        javax.inject.Provider<EntityManagerFactory> emfProvider =
            injector.getProvider(EntityManagerFactory.class);
        HibernateEntityManagerFactory hibernateEntityManagerFactory =
            (HibernateEntityManagerFactory) emfProvider.get();
        SessionFactoryImpl sessionFactoryImpl =
            (SessionFactoryImpl) hibernateEntityManagerFactory.getSessionFactory();
        EventListenerRegistry registry =
            sessionFactoryImpl.getServiceRegistry().getService(EventListenerRegistry.class);

        javax.inject.Provider<BeanValidationEventListener> listenerProvider =
            injector.getProvider(BeanValidationEventListener.class);
View Full Code Here

      this.hem = hem;
   }

   public HibernateIdentityStoreSessionImpl(String persistenceUnit)
   {
      HibernateEntityManagerFactory emFactory = (HibernateEntityManagerFactory)Persistence.createEntityManagerFactory(persistenceUnit);
      hem = (HibernateEntityManager)emFactory.createEntityManager();
   }
View Full Code Here

   */
  public void doWork(DsWork work) {
    // Flush the EntityManager to make sure we have all entities available
    //this.em.flush();
       
    HibernateEntityManagerFactory factory = (HibernateEntityManagerFactory) this.em.unwrap(EntityManagerImpl.class).getEntityManagerFactory();
    SessionFactoryImpl sessionFactory = (SessionFactoryImpl) factory.getSessionFactory();
   
    ConnectionProvider connProvider = sessionFactory.getConnectionProvider();
    DataSource ds = null;
    if (connProvider instanceof DatasourceConnectionProviderImpl) {
      ds = ((DatasourceConnectionProviderImpl) connProvider).getDataSource();
View Full Code Here

TOP

Related Classes of org.hibernate.ejb.HibernateEntityManagerFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.