Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1/56 Mailbox:luckyrajan@linux.net
Dedicated
to
10
to
My Mystic Country
Bharat
20
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
2/56 Mailbox:luckyrajan@linux.net
Rajan's
Enterprise JavaBeans
Session Notes (Draft)
Inetsolv Solutions
(February 2004 Evening Batch)
10
m ailbox : luckyrajan@linux.net
20
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
3/56 Mailbox:luckyrajan@linux.net
My Thoughts:
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
4/56 Mailbox:luckyrajan@linux.net
My Req uest:
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
5/56 Mailbox:luckyrajan@linux.net
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
6/56 Mailbox:luckyrajan@linux.net
Prerequisite knowledge required:
1.Core Java
2.Mult i Thr eadin g 10
3.Netw ork P rogra mming - an y lan guage (Java pref erred )
4.JDBC
5.JNDI
6.XML
7.Serv lets/ JSP
8.RMI
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
7/56 Mailbox:luckyrajan@linux.net
Enterprise JavaBeans
Session 1 of
Dated:16 th June 2004 Wednesday
Topic: Intro to OMTB project
(Online Movie Ticket Booking Project)
10
20
30
Refer back( for b etter unde rstan ding)
1.
2.
3.
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
8/56 Mailbox:luckyrajan@linux.net
Screens Operations
- Login login
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
9/56 Mailbox:luckyrajan@linux.net
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
10/56 Mailbox:luckyrajan@linux.net 10
Enterprise JavaBeans
Session 2 of
Dated:17 th June 2004
Topic: EJB Intro,Development of EJB
SessionBeanStateless using JbuilderX.
10
20
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
11/56 Mailbox:luckyrajan@linux.net
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
12/56 Mailbox:luckyrajan@linux.net
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
13/56 Mailbox:luckyrajan@linux.net
3 file/New
Select EJB Module
Choose appropriate server say ok
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
14/56 Mailbox:luckyrajan@linux.net
MyDiag ram:
----------------------
| Tick et Ma nage |------right click /add/method
----------------------
| Sess ion C ontex t | Enter – method name
----------------------
| Sets essio nCont ext Enter - return type
----------------------
| ejbC reate | Enter - input params(comma
----------------------- separated) 10
Enter - interface
localremote
Javax.ejb.EJBObject is a subinterface of 30
java.rmi.Remote.Similarly javax.ejb.EJBHome is a
subinterface of java.rmi.Remote.
40
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
15/56 Mailbox:luckyrajan@linux.net
Enterprise JavaBeans
Session 3 of
Dated:19 th June 2004 Friday
Topic: Dev of EJB without IDE Tools (Manual)
10
20
30
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
16/56 Mailbox:luckyrajan@linux.net
PLUS
20
6. The business logic according to the business
requirements.
set CLASSPATH=%CLASSPATH%;.
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
17/56 Mailbox:luckyrajan@linux.net
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
18/56 Mailbox:luckyrajan@linux.net
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
19/56 Mailbox:luckyrajan@linux.net
public voi d setS essio nCont ext(S essio nCont ext c tx)
throws EJBE xcept ion,R emote Excep tion 10
Set the associated session context.
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
20/56 Mailbox:luckyrajan@linux.net 20
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
21/56 Mailbox:luckyrajan@linux.net
MyDiag ram:
10
Su mmary of S ession 3/ :
20
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
22/56 Mailbox:luckyrajan@linux.net
Enterprise JavaBeans
Session 4 of
Dated: 19 th June 2004 Saturday
10
Topic: Execution from Client, Session beans
method flow
20
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
23/56 Mailbox:luckyrajan@linux.net
Enterprise JavaBeans
Session 5 of
Dated: 21 st June 2004 Monday 10
Topic: Stateful Session Beans
20
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
24/56 Mailbox:luckyrajan@linux.net
Enterprise JavaBeans
Session 6 of
Dated: 22 nd June 2004 Tuesday 10
Topic: Stateless vs Stateful
20
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
25/56 Mailbox:luckyrajan@linux.net
Enterprise JavaBeans
Session 7 of
Dated: 23 rd Jun e 200 4 Wed nesday 10
Topic: JDBCDirectRead and DTO Design pattern
20
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
26/56 Mailbox:luckyrajan@linux.net
Enterprise JavaBeans
Session 8 of
Dated: 24 th June 2004 Thursday 10
Topic: Container managed Transaction
using JTA,Transactional Attributes
20
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
27/56 Mailbox:luckyrajan@linux.net
Enterprise JavaBeans
Session 9 of
Dated: 25 th June 2004 Friday 10
Topic: Study of Various TA's,Local interfaceHow?
20
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
28/56 Mailbox:luckyrajan@linux.net
Enterprise JavaBeans
Session 10 of
Dated: 26 th June 2004 Saturday
10
Topic: Local vs Remote interface,Security
20
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
29/56 Mailbox:luckyrajan@linux.net
Enterprise JavaBeans
Session 11 of
Dated: 28 th June 2004 Monday
10
Topic: Entity Beans – Using JbuilderX
20
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
30/56 Mailbox:luckyrajan@linux.net 30
Enterprise JavaBeans
Session 12 of
Dated: 29 th June 2004 Tuesday
10
Topic:
20
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
31/56 Mailbox:luckyrajan@linux.net
Enterprise JavaBeans
Session 13 of
Dated: 30 th June 2004 Wednesday
10
Topic:
20
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
32/56 Mailbox:luckyrajan@linux.net
Enterprise JavaBeans
Session 14 of
Dated: 1 st Jul y 200 4 Thu rsday
10
Topic:
20
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
33/56 Mailbox:luckyrajan@linux.net
Enterprise JavaBeans
Session 15 of
Dated: 2 nd July 2004 Friday
10
Topic:
20
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
34/56 Mailbox:luckyrajan@linux.net
Enterprise JavaBeans
Session 16 of
Dated: 3 rd July 2004 Saturday
10
Topic:
20
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
35/56 Mailbox:luckyrajan@linux.net
Enterprise JavaBeans
Session 17 of
Dated: 5 th July 2004 Monday
10
Topic:
20
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
36/56 Mailbox:luckyrajan@linux.net
Enterprise JavaBeans
Session 18 of
Dated: 6 th July 2004 Tuesday
10
Topic:
20
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
37/56 Mailbox:luckyrajan@linux.net
Enterprise JavaBeans
Session 19 of
Dated: 7 th July 2004 Wednesday
10
Topic:
20
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
38/56 Mailbox:luckyrajan@linux.net
Enterprise JavaBeans
Session 20 of
Dated: 8 th July 2004 Thursday
Topic: EJBHome/EJBSelect,Handle,
Environment Entries
10
20
30
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
39/56 Mailbox:luckyrajan@linux.net
AccountBean
public float ejbHomeGetAvgBalance(){...}
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
40/56 Mailbox:luckyrajan@linux.net 40
Handle 30
Reference to a bean.Can be serialized
MyDiag ram:
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
41/56 Mailbox:luckyrajan@linux.net
Refer to Example 4
EJBObject ejbo=Context.getEJBObject()
(in the above context can be session or entity context)
Handle h= ejbo.getHandle();
10
As part of our ejbCode we can write as above to get the
handle.We can return this handle instead of “this”(“this”
cannot be returned)(Refer to Session 19 Wednesday,8th July)
MyDiag ram:
h1=(Handle)ois.readObject();
ejo=h1.getEJBObject(); 20
SesCtxRemote sctx=(SesCtxRemote)ejo;
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
42/56 Mailbox:luckyrajan@linux.net
30
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
43/56 Mailbox:luckyrajan@linux.net
Enterprise JavaBeans
Session 21 of
Dated: 9 th July 2004 Friday
Topic: Session Facade Design Pattern and
EJBHome Caching Design Pattern
10
20
30
Refer back( for b etter unde rstan ding)
1.Sessions on Entity Beans
2.Session on Design Pattern
3.Sessions on servlet/JSP
4.Session on JNDI.
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
44/56 Mailbox:luckyrajan@linux.net
Accoun t Tab le
Accoun t no Balance
1 1999.00
2 2000.00 20
3 400.00
4 6000.00
5 22222.00
String getBal()
void setBal(String)
30
3: String oldamt,newamt;
4: float amt1,amt2;
5: oldamt=acc1.getBal(); 40
//Note return values are String hence we need to parse
6: amt1=Float.parseFloat(oldamt);
7: amt2=amt1-100;
8: newamt=new Float(amt2).toString();
9: System.out.println(“new amount after debit is” +
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
45/56 Mailbox:luckyrajan@linux.net
newamt);
10: acc1.setBal(newamt);
11: oldamt=acc2.getBal();
//Note return values are String hence we need to parse
12: amt1=Float.parseFloat(oldamt);
13: amt2=amt1+100;
14: newamt=new Float(amt2).toString();
15: System.out.println(“new amount after credit is” +
newamt); 10
16: acc2.setBal(newamt);
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
46/56 Mailbox:luckyrajan@linux.net
2: Context ic;
3: try{
4: ic=new InitialContext()
// Since client is at server side calling a bean
locally 10
5: MyAccountHome home=(MyAccountHome)ic.lookup
(“MyAccount”);
6: MyAccount acc1=home.findByPrimaryKey(ac1);
7: MyAccount acc2=home.findByPrimaryKey(ac1);
8: String oldamt,newamt;
9: float amt1,amt2;
10: oldamt=acc1.getBal(); 20
//Note return values are String hence we need to parse
11: amt1=Float.parseFloat(oldamt);
12: amt2=amt1-100;
13: newamt=new Float(amt2).toString();
14: System.out.println(“new amount after debit is” +
newamt);
15: acc1.setBal(newamt);
16: oldamt=acc2.getBal();
//Note return values are String hence we need to parse 30
17: amt1=Float.parseFloat(oldamt);
18: amt2=amt1+100;
19: newamt=new Float(amt2).toString();
20: System.out.println(“new amount after credit is” +
newamt);
21: acc2.setBal(newamt);
22: }catch(Exception e){}
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
47/56 Mailbox:luckyrajan@linux.net
MyDiag ram:
long t1,t2;
t1=System.currentTimeMillis();
.......
}
t2=System.currentTimeMillis();
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
48/56 Mailbox:luckyrajan@linux.net
t1+t2);
20
Scenario:
Let us take a case where the below screen got generated by
a Servlet/JSP.
Clicking the tranfer button will result in accessing the
bean and the execution of remote call.
Account Id From
32112333212121
32112333434343
Account Id To
30
10000
Amount
Transfer
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
49/56 Mailbox:luckyrajan@linux.net
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
50/56 Mailbox:luckyrajan@linux.net 50
home=(SesFacadeHome)servletcontext.getAttribute
(“homeref”);
MyDiag ram:
Main ones
MVC 10
Front Controller
Singleton
DTO (Data transfer Object) – For Report
Session Facade
JDBCDirectRead
Rowset instead of resultset.
20
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
51/56 Mailbox:luckyrajan@linux.net
10
Enterprise JavaBeans
Session 22 of
Dated: 12 th July 2004 Monday
Topic:
20
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
52/56 Mailbox:luckyrajan@linux.net
1.
2.
3.
1.http://www.theserverside.com
2.http://java.sun.com/ejb
3.http://java.sun.com/j2ee
4.http://www.weblogic.com
5.http://jakarta.apache.org
6.http://www.mysql.org
20
30
40
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
53/56 Mailbox:luckyrajan@linux.net
AfterThought
40
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
54/56 Mailbox:luckyrajan@linux.net
About MySelf
30
40
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
55/56 Mailbox:luckyrajan@linux.net
Guidelines
to
Method 1:
Visit http://groups.yahoo.com/
Enter Searc h wor d idevcircle click search you will be
gettin g the grou p pag e.Fol low t he in struc tions give n.
Method 2:
Visit http://geocities.com/idevcircle and subscribe by
enteri ng yo ur va lid e mail id. 20
Method 3:
Visit http://groups.yahoo.com/group/idevcircle you
will be getting the group page.Follow the instructions
given.
Method 4:
Send email to idevcircle-subscribe@yahoogroups.com
from the email acco unt you want to receive messages
from the group. You will be rec eivin g a confirmation 30
mail. Follo w the inst ructi ons g iven to Jo in.
MyNote :
1.You need to ha ve ya hoo m ember ship to jo in th e gro up.
2.You can just join in the mail ing list to rec eive 40
messag es being posted in the group or you can join in
the group as group m ember to sh are all group reso urces
like f iles, links etc.
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf
Rajan's Enterprise JavaBeans Session Notes
56/56 Mailbox:luckyrajan@linux.net
24 t h
July 2004
for
Raj an 's Enterpr ise Ja va Be ans
Sessi ons Notes
(Draft)
20
1 st August 2004
Raj an 's Enterpr ise Ja va Be ans
Sessi ons Notes
(FINAL)
40
Share to Grow @ idevcircle :The Developers Circle Group URL: http://geocities.com/idevcircle
RajansEJBSessionNotes1.4 (Draft).pdf