[jboss-user] [EJB 3.0] - Re: Looking up a PU from @PersistenceContext annotation

wolfc do-not-reply at jboss.com
Wed Jan 7 12:53:21 EST 2009


After injecting PersistenceUnitDependencyResolver, this piece of pseudo code should do the trick:
String beanName = persistenceUnitDependencyResolver.resolvePersistenceUnitSupplier(deploymentUnit, persistenceUnitName);
  | PersistenceUnitDeployment deployment = lookup(beanName);
  | ManagedEntityManagerFactory managedFactory = deployment.getManagedFactory();
  | return new InjectedEntityManagerFactory(managedFactory);
Although PersistenceUnitDeployment is an internal. Maybe we should add a simple utility class to jpa-deployers.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4200154#4200154

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4200154



More information about the jboss-user mailing list