Tell it which of the three class files in the JAR is the actual BEAN class

You have three class files in the JAR: the home interface (AdviceHome), the component interface (Advice), and the bean (AdviceBean). But the EJB container needs to know which is which. Remember, the naming convention doesn’t mean anything to anyone but you! The container won’t look at the three classes in the JAR and recognize that AdviceHome must be the home interface, and so on[3]. No, the naming convention is for you and anyone else using your bean components.

So, now you have to tell the tool which of the files is the bean class (we’ll do the two interfaces on the next page). The tool, then, will put this info into the deployment descriptor.

Click the Enterprise Bean Class drop-down menu

Select headfirst.AdviceBean

image with no caption


[3] There are some vendor tools that can use your naming convention, among other things, to figure out which is the home, which is the bean, etc. But the RI doesn’t do this, and development tool support is not part of the EJB spec. The only tools required by the spec are for the Deployer, not the Bean Provider or App Assembler.

Get Head First EJB now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.