Sun GlassFish Web Space Server 10.0 Developer's Guide

ProcedureCreating Entities in the service.xml GUI Editor

  1. Click Add.

    The Service Definition window appears.

  2. Specify the Entity Name as Movie and the Table Name for the entity as tb_movie.

  3. Select the Remote Service checkbox and click Add.

    The entity Movie is created with the Remote value as true.

  4. Change the default Package Path name to com.sample.movie.

    After creating an entity, you need to add columns for the entity.

  5. Click Add under the Columns tab.

    The Column Details window appears.

  6. Specify the Name of the column as name and the column type as String.

    You can choose the column type as String, Double, and Date from the drop down list.

  7. Select the Primary Key checkbox and click Add.

    A column is created with the Column Name as name and type as String.

  8. Add three more columns with the Column Types cast, story, and releaseDate with types String, String, and Date respectively.

    You can see that there are four columns created for the Movie entity.

  9. Add another entity called MovieFeedback with the Table Name as tb_moviefeedback.

  10. Add columns such as id, movieName, rating, and feedback with types long, string, string, and string respectively.

    You can see that there are four columns created for the MovieFeedback entity.

    You need to add a Finder method for the MovieFeedback entity.

  11. Click the Finders tab.

  12. Click Add Finder.

    The Finder Details window appears.

  13. Specify the Finder Name as MovieName.

  14. From the Available Columns pane, select movieName and click Add.

    The movieName method is added under the Finder Columns pane. Since the movieName is the finder method, you can search the details of a movie by the name of a movie.

    If you want to set the properties for the finder method, click Properties and choose any Comparators.

  15. Click Add.

    You can see that the finder method is added to the service.xml and the same method appears in GUI editor.