FileDocCategorySizeDatePackage
InjectedEntityManagerFactory.javaAPI DocJBoss 4.2.13278Fri Jul 13 20:53:58 BST 2007org.jboss.ejb3.entity

InjectedEntityManagerFactory

public class InjectedEntityManagerFactory extends Object implements EntityManagerFactory, Externalizable
Comment
author
Bill Burke
version
$Revision: 60233 $

Fields Summary
private static final long
serialVersionUID
private transient EntityManagerFactory
delegate
private transient ManagedEntityManagerFactory
managedFactory
Constructors Summary
public InjectedEntityManagerFactory()

   
     
public InjectedEntityManagerFactory(ManagedEntityManagerFactory managedFactory)

      assert managedFactory != null : "managedFactory is null";
      
      this.delegate = managedFactory.getEntityManagerFactory();
      this.managedFactory = managedFactory;
   
Methods Summary
public voidclose()

      throw new IllegalStateException("It is illegal to close an injected EntityManagerFactory");
   
public javax.persistence.EntityManagercreateEntityManager()

      return getDelegate().createEntityManager();
   
public javax.persistence.EntityManagercreateEntityManager(java.util.Map map)

      return delegate.createEntityManager(map);
   
public javax.persistence.EntityManagerFactorygetDelegate()

      return delegate;
   
public javax.persistence.EntityManagergetEntityManager()

      return new TransactionScopedEntityManager(managedFactory);
   
public booleanisOpen()

      return getDelegate().isOpen();
   
public voidreadExternal(java.io.ObjectInput in)

      String kernelName = in.readUTF();
      PersistenceUnitDeployment deployment = PersistenceUnitRegistry.getPersistenceUnit(kernelName);
      if (deployment == null) throw new IOException("Unable to find persistence unit in registry: " + kernelName);
      managedFactory = deployment.getManagedFactory();
      delegate = managedFactory.getEntityManagerFactory();
   
public voidwriteExternal(java.io.ObjectOutput out)

      out.writeUTF(managedFactory.getKernelName());