A session bean is a short-lived object containing business methods that can be executed by a client. In the example you are creating a stateless session bean that implements a CalculateFreightCost business method, hosted in an EJB container.
When a client wants to execute a method in a session bean, the EJB container creates an instance of that session bean. The lifetime of the session bean is equivalent to the client session. A stateless session bean does not maintain state across business method calls. This means any instance of stateless beans can be used by any client at any time. A stateful session bean, on the other hand, is associated with a specific client, and maintains state across multiple method invocations made by the same client.
You will put the session bean in its own package. Partitioning your EJBs in different packages can be less confusing when there are many components in a project.
Copyright © 1997, 2009, Oracle. All rights reserved.