J2EE Connector Introduction

Use the J2EE Connector to create Java applications that integrate host data into J2EE application servers. This section describes the J2EE connector and provides tips on how to build powerful and robust applications that take advantage of the connector's features and options. For optimum compatibility with other J2EE components, the J2EE Connector implements the J2EE Common Client Interface (CCI). The J2EE Connector supports only the CCI “no-transaction” transactional mode. Screen-based host applications are not transactional.

You can use the Web Builder tool to create EJB projects, based on the "demo" models provided with Verastream Host Integrator, and then examine the Java code in your projects to see how the J2EE connector works. Using this knowledge, you can design your own applications directly around the J2EE Connector, or use the Web Builder tool to generate EJBs based on your own custom models. These generated EJBs are very similar to the standard Java Beans projects that Web Builder also generates.

EJB Support

Web Builder generates local and remote, stateful or stateless session EJBs. The EJBs use the J2EE Connector to communicate with VHI Session Server.

Stateful session beans

Stateful EJBs preserve the host session state between client invocations of EJB business methods. If not used for an extended period (configurable) EJBs may be “passivated” to disk, to be “activated” later, when the client returns for further interaction. Behind the scenes, the application server automatically invokes ejbPassivate() and ejbActivate() as appropriate to manage its resources. The J2EE Connector supports EJB passivation and activation by suspending and resuming the host session on the Session Server. Passivation eventually expires in order to prevent permanently stranding host and server resources in case the client never returns. Stateful application designs do not scale as well as stateless designs, because other clients cannot use resources associated with a stateful client interaction.

Stateless session beans

Stateless EJBs do not preserve state between client invocations; rather, they assume each business method call is completely independent of previous or subsequent invocations. Because they do not keep host and server resources tied up between client invocations, stateless application designs may scale better than stateful designs.

Local and remote session beans

The Web Builder tool generates both local and remote session beans. Traditional EJB access has always been remote via Java Remote Method Invocation, or RMI. While more flexible, this results in unnecessary overhead if access is purely local. You can use the local interfaces if you know that you will not require remote access.