Tham khảo tài liệu 'building java enterprise applications volume i: architecture phần 4', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Building Java Enterprise Applications Volume I Architecture It is a good idea at this point to actually deploy the Sequence session . bean along with the Office entity bean. You can compile these classes 3 wrap them up in the JAR archive as I talked about in the previous chapter and deploy the JAR into your container as described in Appendix D . Although you haven t added any functionality to your entity bean or taken advantage of the new session bean you can head off any errors here. Choosing not to do this widens the window of errors that may occur. It s better to catch small mistakes and typos in your code or descriptor now by deploying the beans before continuing. Integrating the Changes Now that the sequencing functionality is available to the application you just need to take advantage of it. With the need for an ID eliminated from entity beans clients you first need to change the home interface s create method as I talked about earlier. This simply involves removing the id variable from the method signature. That change results in the following create signature in the OfficeHome class public Office create String city String state throws CreateException RemoteException You should make the same change to the OfficeLocalHome interface public OfficeLocal create String city String state throws CreateException EJBException The next change in the code is the bean implementation itself. The ejbCreate and ejbPostCreate methods both should have the id variable removed from their method signatures. Be sure you change both of these as it s easy to forget the ejbPostCreate method. Finally this bean needs to access the new Sequence bean and use it to obtain an ID value for a new office. This is a replacement for accepting the value from a bean client. Modify your bean s ejbCreate method as shown in Example 5-9. Once you ve added the necessary import statements to deal with JNDI RMI and the Sequence bean you are ready to access the next primary key value through the