Investigate:
http://biemond.blogspot.com/2010/04/ejb-injection-in-jsf-managed-bean.html
and
http://technology.amis.nl/blog/4260/ejb-dependency-injection-of-session-bean-facade-in-jsf-12-on-weblogic-103-jsf-with-jpa
>both have been deprecated recently.
Since the Oracle WebLogic 10.3.4.0 release on 15 Jan 2011 - EJB injection on a JSF managed bean can be accomplished by pure annotation. For example, here is part of the Collatz Distributed project where we inject a @Stateless session bean into an @ManagedBean JSF 2.0 managed bean. The Stateless session bean is itself dependency injected with a JPA 2.0 @PersistenceContext EntityManager for ORM JTA transactions either via standard Java EE 5 EJB tier JTA container managed transactions or even in the Web container using EJB 3.1 Lite and JTA 1.1 as part of the Web Profile.
@Stateless(mappedName = "ejb/CollatzFacade") public class CollatzFacade implements CollatzFacadeRemote, CollatzFacadeLocal { @PersistenceContext(unitName = "CollatzGF-ejbPU", type=PersistenceContextType.TRANSACTION) private EntityManager entityManager; ... } @ManagedBean(name="collatzBean") @SessionScoped public class MonitorManagedBean { @EJB(name="ejb/CollatzFacade") private CollatzFacadeLocal collatzFacade; .. }
No comments:
Post a Comment