O'Reilly logo

EJB 3.1 Cookbook by Richard M. Reese

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Handling an object-based message

This is the last in the series of recipes illustrating how to send an order type message. In this recipe we will use a simple Java class called Order to represent the order and an ObjectMessage object to encapsulate the Order object. Since an order is best represented as a class, the ObjectMessage is the preferred technique for sending an order.

Getting ready

The essential structure of a servlet used to generate a message was introduced in the introduction. Here we will address the unique elements of creating and using an ObjectMessage which include:

  1. Creating an ObjectMessage using the createObjectMessage method
  2. Attaching the object to the ObjectMessage using the setObject method
  3. Sending the message

How to do it... ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required