Package org.jboss.ejb3.entity

Examples of org.jboss.ejb3.entity.ManagedEntityManagerFactory$SessionSynchronization


   }


   private static SessionFactory getSessionFactory(String ref, InjectionContainer container) throws NameNotFoundException
   {
      ManagedEntityManagerFactory managedFactory;
      PersistenceUnitDeployment deployment = container.getPersistenceUnitDeployment(ref);
      if (deployment != null)
      {
         managedFactory = deployment.getManagedFactory();
      }
View Full Code Here


   }

   public void inject(InjectionContainer container)
   {
      String error1 = error;
      ManagedEntityManagerFactory factory = null;
      try
      {
         factory = PersistenceUnitHandler.getManagedEntityManagerFactory(
                 container, unitName);
      }
      catch (NameNotFoundException e)
      {
         error1 += " " + e.getMessage();
      }
      if (factory == null)
      {
         throw new RuntimeException(error1);
      }
      if (type == PersistenceContextType.EXTENDED)
      {
         if (!(container instanceof StatefulContainer))
            throw new RuntimeException("It is illegal to inject an EXTENDED PC into something other than a SFSB");
         container.getInjectors().add(0, new ExtendedPersistenceContextInjector(factory));
         Object extendedPc;
         if (injectionType == null
                 || injectionType.getName().equals(EntityManager.class.getName()))
         {
            extendedPc = new ExtendedEntityManager(factory.getKernelName());
         }
         else
         {
            ExtendedSessionInvocationHandler handler = new ExtendedSessionInvocationHandler(factory.getKernelName());
            extendedPc = Proxy.newProxyInstance(
                  Session.class.getClassLoader(), //use the Hibernate classloader so the proxy has the same scope as Hibernate
                  SESS_PROXY_INTERFACES,
                  handler
            );
View Full Code Here

   }

   public static ManagedEntityManagerFactory getManagedEntityManagerFactory(InjectionContainer container, String unitName)
           throws NameNotFoundException
   {
      ManagedEntityManagerFactory factory;
      PersistenceUnitDeployment deployment = container.getPersistenceUnitDeployment(unitName);
      if (deployment != null)
      {
         factory = deployment.getManagedFactory();
      }
View Full Code Here

      return getEntityManagerFactory(unitName, container);
   }

   public static EntityManagerFactory getEntityManagerFactory(String unitName, InjectionContainer container) throws NameNotFoundException
   {
      ManagedEntityManagerFactory managedFactory;
      PersistenceUnitDeployment deployment = container.getPersistenceUnitDeployment(unitName);
      if (deployment != null)
      {
         managedFactory = deployment.getManagedFactory();
      }
View Full Code Here

   }


   private static SessionFactory getSessionFactory(String ref, InjectionContainer container) throws NameNotFoundException
   {
      ManagedEntityManagerFactory managedFactory;
      PersistenceUnitDeployment deployment = container.getPersistenceUnitDeployment(ref);
      if (deployment != null)
      {
         managedFactory = deployment.getManagedFactory();
      }
View Full Code Here

   }

   public void inject(InjectionContainer container)
   {
      String error1 = error;
      ManagedEntityManagerFactory factory = null;
      try
      {
         factory = PersistenceUnitHandler.getManagedEntityManagerFactory(
                 container, unitName);
      }
      catch (NameNotFoundException e)
      {
         error1 += " " + e.getMessage();
      }
      if (factory == null)
      {
         throw new RuntimeException(error1);
      }
      if (type == PersistenceContextType.EXTENDED)
      {
         if (!(container instanceof StatefulContainer))
            throw new RuntimeException("It is illegal to inject an EXTENDED PC into something other than a SFSB");
         container.getInjectors().add(0, new ExtendedPersistenceContextInjector(factory));
         Object extendedPc;
         if (injectionType == null
                 || injectionType.getName().equals(EntityManager.class.getName()))
         {
            extendedPc = new ExtendedEntityManager(factory.getKernelName());
         }
         else
         {
            ExtendedSessionInvocationHandler handler = new ExtendedSessionInvocationHandler(factory.getKernelName());
            extendedPc = Proxy.newProxyInstance(
                  Session.class.getClassLoader(), //use the Hibernate classloader so the proxy has the same scope as Hibernate
                  SESS_PROXY_INTERFACES,
                  handler
            );
View Full Code Here

/*     */
/*     */   public static ManagedEntityManagerFactory getManagedEntityManagerFactory(InjectionContainer container, String unitName)
/*     */     throws NameNotFoundException
/*     */   {
/* 139 */     PersistenceUnitDeployment deployment = container.getPersistenceUnitDeployment(unitName);
/*     */     ManagedEntityManagerFactory factory;
/* 140 */     if (deployment != null)
/*     */     {
/* 142 */       factory = deployment.getManagedFactory();
/*     */     }
/*     */     else
/*     */     {
/* 146 */       throw new NameNotFoundException("Unable to find persistence unit: " + unitName + " for deployment: " + container.getIdentifier());
/*     */     }
/*     */     ManagedEntityManagerFactory factory;
/* 148 */     return factory;
/*     */   }
View Full Code Here

/*     */
/*     */   public static EntityManagerFactory getEntityManagerFactory(String unitName, InjectionContainer container)
/*     */     throws NameNotFoundException
/*     */   {
/* 167 */     PersistenceUnitDeployment deployment = container.getPersistenceUnitDeployment(unitName);
/*     */     ManagedEntityManagerFactory managedFactory;
/* 168 */     if (deployment != null)
/*     */     {
/* 170 */       managedFactory = deployment.getManagedFactory();
/*     */     }
/*     */     else
/*     */     {
/* 174 */       return null;
/*     */     }
/*     */     ManagedEntityManagerFactory managedFactory;
/* 176 */     return new InjectedEntityManagerFactory(managedFactory);
/*     */   }
View Full Code Here

/*     */
/*     */   private static SessionFactory getSessionFactory(String ref, InjectionContainer container)
/*     */     throws NameNotFoundException
/*     */   {
/* 183 */     PersistenceUnitDeployment deployment = container.getPersistenceUnitDeployment(ref);
/*     */     ManagedEntityManagerFactory managedFactory;
/* 184 */     if (deployment != null)
/*     */     {
/* 186 */       managedFactory = deployment.getManagedFactory();
/*     */     }
/*     */     else
/*     */     {
/* 190 */       return null;
/*     */     }
/*     */     ManagedEntityManagerFactory managedFactory;
/* 192 */     return new InjectedSessionFactory(managedFactory);
/*     */   }
View Full Code Here

/*    */   }
/*    */
/*    */   public void inject(InjectionContainer container)
/*    */   {
/* 72 */     String error1 = this.error;
/* 73 */     ManagedEntityManagerFactory factory = null;
/*    */     try
/*    */     {
/* 76 */       factory = PersistenceUnitHandler.getManagedEntityManagerFactory(container, this.unitName);
/*    */     }
/*    */     catch (NameNotFoundException e)
/*    */     {
/* 81 */       error1 = error1 + " " + e.getMessage();
/*    */     }
/* 83 */     if (factory == null)
/*    */     {
/* 85 */       throw new RuntimeException(error1);
/*    */     }
/* 87 */     if (this.type == PersistenceContextType.EXTENDED)
/*    */     {
/* 89 */       if (!(container instanceof StatefulContainer))
/* 90 */         throw new RuntimeException("It is illegal to inject an EXTENDED PC into something other than a SFSB");
/* 91 */       container.getInjectors().add(0, new ExtendedPersistenceContextInjector(factory));
/*    */       Object extendedPc;
/*    */       Object extendedPc;
/* 93 */       if ((this.injectionType == null) || (this.injectionType.getName().equals(EntityManager.class.getName())))
/*    */       {
/* 96 */         extendedPc = new ExtendedEntityManager(factory.getKernelName());
/*    */       }
/*    */       else
/*    */       {
/* 100 */         ExtendedSessionInvocationHandler handler = new ExtendedSessionInvocationHandler(factory.getKernelName());
/* 101 */         extendedPc = Proxy.newProxyInstance(org.hibernate.Session.class.getClassLoader(), SESS_PROXY_INTERFACES, handler);
/*    */       }
/*    */
/*    */       try
/*    */       {
View Full Code Here

TOP

Related Classes of org.jboss.ejb3.entity.ManagedEntityManagerFactory$SessionSynchronization

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.