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     
       |