How Do I: Add a Component Method to an Entity or Session Bean?

Follow these steps to add a business method to an entity or session bean:

  1. Make sure that the EJB is displayed in Design View.
  2. Right-click the right-hand area of the bean, and choose Add Component Method. A new component method appears.
  3. Enter the correct method name and signature.
  4. Right-click the arrow to the left of the method name to change the visibility. You can define a bean's business method in the local interface, the remote interface, or both.

    Notice that for entity beans, by default a business method is defined in the local interface. For session beans, a business method is defined by default in the remote interface.

  5. Click the method name to go to Source View, and implement the business logic.

Related Topics

How Do I: Test an Enterprise JavaBean?

How Do I: Use an Enterprise JavaBean in a Web Application?

Developing Enterprise JavaBeans