Common Expenses: EJB

To communicate with POJO entities I’m going to use EJB version 3.1.

As done before I will use annotation instead of a XML configuration file.

I will come back later with a full post on how to couple EJB with Hibernate.

Essentialy we need an Interface for make the bean accessible from other tools (in this case I’ll use Servelt to access EJB):

public interface RegisterBeanRemote

Remote means that this is he ‘server‘ class, in this instance our client will be the Servlets but if it would have been another java application we would have to distinguish between Remote and Local.

When the interface is ready we need a class to implement it:

public class RegisterBean implements RegisterBeanRemote

Stateless means that the bean doesn’t keep a ‘memory‘.

There’s no need to use JNDI explixity because annotation will do it for us.

Leave a Reply

Your email address will not be published. Required fields are marked *