Monday, March 1, 2010

EJB 3.0 super fast tutorial

Create an EJB project PVEJB30Test.

Create an Interface- this will be the remote interface of your Stateless EJB:

package com.pierre;

public interface Messenger {
    String getMessage(String name);

Create the Implementation:

package com.pierre;

import javax.ejb.Remote;
import javax.ejb.Stateless;

public class MessengerSB implements Messenger {
    public String getMessage(String name) {
        return "Ciao " + name;

Deploy your project to the WebLogic Server:

You will magically get this:

Application Name: PVEJB30Test
EJB Module Name:PVEJB30Test
Bean Name: MessengerSB

Easy. It could be easier (for instance, not having to create the Interface) but it's easy.

In the JNDI tree you will get:

PVEJB30TestPVEJB30TestMessengerSB_Home (=
PVEJB30TestPVEJB30TestMessengerSB_Messenger (=
If you specify
you will get this binding:

No comments: