How Do I: Add a Home Method to an Entity Bean?

A home method is a business method that is not specific to one bean instance. For example, a HotelRooms entity bean might have a getViewCount home method that returns the number of rooms with a view. A home method is invoked on the bean's (local or remote) home interface.

To Add a Home Method

  1. Make sure that the entity bean is displayed in Design View.
  2. Right-click the right-hand area of the bean, and choose Add Home Method. A new home method appears.
  3. Enter the correct method name and signature.

    Remember that the method name in the bean must have the ejbHome prefix. For instance, the method getViewCount defined in the bean's (local or remote) home interface must be implemented in the entity bean as ejbHomeGetViewCount.

  4. Right-click the arrow to the left of the method name to change the visibility. You can define the home method in the local interface, the remote interface, or both.
  5. Click the method name to go to Source View, and implement the business logic.

Related Topics

How Do I: Add a Finder Method to an Entity Bean?

How Do I: Add a Select Method to an Entity Bean?

Developing Enterprise JavaBeans