Defining a Business Method
See Also
A business method is a method inside
an enterprise bean that performs some function and is available for any clients
of the bean.
To define a business method for an enterprise bean:
- Open the bean class in the Source Editor.
- Right-click anywhere in the Source Editor and choose Insert Code > Add
Business Method.
- In the Add Business Method dialog box, define the method signature:
- Name the method.
- Specify the return type.
- Specify the method parameters in the Parameters tab.
- Specify the exceptions that the method throws in the Exceptions
tab.
- Specify whether to add the business method to the local interface, remote
interface, or both.
- Click OK to create the method.
The IDE adds the method signature to the interfaces and the method body
to the bean class.
- Edit your new business method.
Notes:
- When you create an EJB 2.1 enterprise bean (J2EE 1.4), the IDE creates a special
Business interface in which it registers business
methods. The bean interface extends the Business interface
and the bean class implements both the Business interface
and the bean interface.
- When the IDE adds a business method to an enterprise bean, it does not save the
bean class or the bean interfaces. Only when you compile or save the class
is the new method saved to disk.
- See Also
- About Business Methods
- Creating an Enterprise Bean
- Defining a Finder Method
- Defining a Select Method
Legal Notices