| How to call an EJB 2 from an EJB 3 ? |
| Written by Mark S. | |||||
|
The EJB 3 specification mandates that all container should support EJB 2 as well. It's even possible to inject an EJB 2 into an EJB 3. Here's how to do it:
@Stateless
public InsertOrderBean implements InsertOrder {
..
@EJB
public BankAccountHome bankAccountHome;
..
void payorder(){
...
BankAccount bankAccount
= bankAccountHome.create();
bankAccount.debitSum(money);
}
}
Here the BankAccountHome in injected into the EJB InsertOrderBean and, inside method payorder(), used to take one instance of the BankAccount Bean from the pool
JBoss.org Search
Custom Search
Only registered users can write comments!
Powered by !JoomlaComment 3.26
3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved." |


