1. In the project structure, expand the node Web Dynpro → Models. From the context menu, choose Create Model to start the appropriate wizard.
2. Choose the Enterprise JavaBean Model option, followed by Next.
3. Enter MyStudsModel in the Model Name field and specify com.sap.tc.cm.ejb.example.model as the Model Package. Choose Next.
4. Select the Enterprise Application DC studsapp that provides the public part with the Enterprise JavaBeans required for model import. Choose Next.
A list of Session Beans, interfaces and their business methods appears.
5. Select getStudent method from the StudsLocal interface. Choose Next.
A list of model classes to be generated, is displayed on the next screen.
6. Choose Next.
7. Start the model generation routine with Finish.
You have now created a model named MyStudsModel in your Web Dynpro project. In accordance with the MVC paradigm, the model was not simply generated as part of the Web Dynpro component, but as an independent development object.
The generated model classes are now visible within the project structure in the Web Dynpro Explorer under the Models node.
Command Pattern in the EJB Model
Command pattern means to encapsulate an operation and give it an object representation. It is quite often used in Web Dynpro and is also applied in the newly introduced EJB Model. According to the command pattern, each business method of the Enterprise JavaBean is represented by a so called Request model class. The Request model class contains all the business method input parameters either as properties (in case of simple types) or relations (in case of JavaBeans, collections or arrays). If the business method has a return type, then the corresponding Response model class is created as well and linked as a relation in the Request model class.