To operate with the database of your application you need at least the four basic functions — create, read, update, and delete (CRUD). These functions are provided by the CRUD facade. Using the SAP NetWeaver Developer Studio you can apply the Session Bean CRUD Facade template to an entity and generate a CRUD facade using stateless session beans. After generating the template, you can implement the business logic of your application.
You have an EJB project created with Java Persistence facet with at least one entity to which you are to apply the Session CRUD template.
You can generate a Session Bean CRUD Facade template in the Project Explorer of the Java EE perspective, or by using the JPA (Java Persistence API) editor.
Select an entity. In its context menu, choose Apply Template...
Select Session Bean CRUD Facade from the Available Templates list. Choose Next.
(Optional) In the EJB project field, specify the project where the stateless session beans will be created. You can use an existing EJB project or create a new one. At this point, you can specify another entity to apply this template to by choosing another persistence unit from a different project in the Persistence Unit field and selecting the appropriate checkbox in the Entities field. Choose Next.
(Optional) Specify the bean class, name, and package for the session bean and choose Next.
(Optional) Specify additional information about the session bean such as the mapped name and transaction type, and choose Next.
(Optional) Select the appropriate fields for the named queries.
Note
You use these named queries if you want to search by some of the attributes of the entity. The primary key is not listed because such a named query will be created by default.
Choose Finish.