Home Interface - User (cont)
  • The User home interface contains two finder methods
    • findByPrimaryKey()
    • findAllUsers()
  • Each home interface must have a findByPrimaryKey() method
    • Q: What is a primary key?
    • A: A primary key is a serializable Java object whose value uniquely identifies an entity bean in the context of a given "system"
      • The system designer determines an appropriate primary key for each entity bean type
      • For the User EJB, the primary key is basically the login ID
  • findByPrimaryKey() attempts to locate a User EJB based on the given primary key
  • findAllUsers() returns a java.util.Enumeration that contains references to all of the users in the system
    • Returning a java.util.Collection is also valid from V1.1 onward

Next Slide >>