Inside Scoop on J2EE : Tips and tricks on J2EE and Oracle Application Server by Debu Panda
Updated: 2/7/2005; 3:25:40 PM.

 

Subscribe to "Inside Scoop on J2EE" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.

 
 

Monday, January 17, 2005

 

It's now real, at least for me. This is the first EJB 3.0  that I  built, deployed and executed on our EJB 3.0 implementation that we are building on. To realize what are things being simplified in EJB 3.0, I took a backward approach. I used JDeveloper 10g to create the HelloWorld EJB and then modified manually to get rid of garbage code that we now need in EJB 2.x.

 

I plan to write a series of blogs demonstrating how EJB 3.0 simplify developerís life and will provide simple code examples. If you want to know some new features of EJB 3.0 please take a look at Simplify EJB 3.0 Development with EJB 3.0.

 

Here is the remote interface for my HelloWorld EJB. Please note that this is a pure Java interface and it does not extend  EJBObject. 

 

 

package debu.ejb30;

import java.rmi.Remote;

 

public interface HelloWorld extends Remote

{

  public void sayHello(String name);

}

 

I do not like annotations too much so I still use deployment descriptor to specify my remote interface. Here is the bean implementation class which evidently is a POJO and does not implement javax.ejb.SessionBean interface:

 

package debu.ejb30;

 

public class HelloWorldBean implements HelloWorld

{

public void sayHello(String name)

{

  System.out.println("Hell "+name +" from first EJB3.0");

}

 }

 

You have to note that I no longer require EJB home interface and do not have to create a bean instance by invoking create and can directly invoke a method on the EJB.

 

Here is my client code:

 

      Context context = new InitialContext();

      HelloWorld helloWorld =  (HelloWorld)context.lookup("java:comp/env/ejb/HelloWorld");

      // Call any of the Remote methods below to access the EJB

       helloWorld.sayHello("Debu");

 

 

I really love this lean and thin EJBs and I am sure you will love this too!

 

 

 

 

 


12:31:41 PM    comment []

© Copyright 2005 Debu Panda.

PS: These are my own thoughts and not of my employer ..



Click here to visit the Radio UserLand website.
 


January 2005
Sun Mon Tue Wed Thu Fri Sat
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Dec   Feb