JBoss recipe of the day

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

0
0
0
s2smodern

Related articles available on mastertheboss.com

EJB 3.0 tutorial : Session Beans

Enterprise JavaBeans (EJB) technology is a J2EE technology for de

JBoss MDB 3.0

Message-driven beans (MDBs) are stateless, server-side, transacti

JBoss EJB 3 BMT

In a Bean Managed Transaction, the code in the session or message

How do you keep your EJB callbacks separated from biz. methods?

JBoss daily recipe

How to set EJB timeout period ?

JBoss recipe of the day

How to add a Selector with MDB 3.0 ?

Message selectors allow an MDB to be more selective about the mes

W

i

l

d

F

l

y

 

c

h

e

a

t

s

h

e

e

t