You put three kinds of things in your bean class:
Things from the home interface
For each create() method in the home, you must have a matching ejbCreate() and ejbPostCreate() method in the bean class.
For each business method in the home, you must have a matching ejbHome<method> in the bean class.
For CMP beans, you will NOT write matching finder methods. The Container will write them for you, based on info you put in the deployment descriptor. (We’ll go over all that in the next chapter.)
<<interface>>
CustomerHome
create(String last, String first, String address)
findByPrimaryKey(String key)
findByCity(String city)
updateAll(String cmd)
Things from the component interface
For each method in the component interface, you must have a matching concrete implementation in the bean class.
<<interface>>
Customer
getFirstName()
setFirstName(String name)
getLastName()
setLastName(String name)
getAddress()
setAddress(String addr)
Things from the EntityBean interface
You must implement the EntityBean interface either directly or indirectly. So unless you have a superclass that implemented the methods, you’re responsible for writing concrete implementations in your bean class.
<<interface>>
EntityBean
setEntityContext(EntityContext ec)
ejbActivate()
ejbPassivate()
ejbRemove()
unsetEntityContext()
ejbLoad()
ejbStore()
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access