Generating Java Object API Code

Use the Generate Code wizard to generate object API code for the SUP101 mobile application project. The code generation creates the business logic, attributes, and operations for the mobile business objects in the project.

Prerequisites
In Enterprise Explorer, you must be connected to both My Sample Database and My Unwired Server. Code generation fails if the server-side (runtime) enterprise information system (EIS) datasources referenced by the MBOs in the project are not running and available to connect to when you generate object API code.
Task
  1. In Unwired WorkSpace, open the SUP101 mobile application project.
    In WorkSpace Navigator, right-click the SUP101 folder and select Open in Diagram Editor.
  2. (Optional) If you are performing other tutorials, add a new folder to the project to organize the generated code for each device platform.
    For example, in WorkSpace Navigator, expand SUP101 and under Generated Code add a RIM folder. The Generated Code directory was created during the MBO tutorial.
  3. Right-click anywhere in the SUP101 - Mobile Application Diagram and select Generate Code.
  4. In the Generate Code wizard, click Next to select the default configuration and continue without any changes.
  5. In the Select Mobile Business Objects page, select the Customer MBO, then click Next.
  6. In the Configure Options page, specify these values and click Finish.
    Option Description
    Language Java
    Platform Java ME for BlackBerry
    Unwired server My Unwired Server
    Server domain Accept default value.
    Page size Accept default value of 1024.
    Package (Optional) A unique name for the Java package.
    Project path Leave the default, \SUP101\Generated Code, or browse to another folder you created for the device platform in step 2.
    Third-party jar file

    You do not need to choose one for this tutorial.

    You see a warning at the top of the page: The third-party class 'net.rim.device.api.system.ApplicationDescriptor' cannot be found. You can ignore this warning; it does not affect code generation.

    Generate JavaDoc Unselect.
    You can ignore the error icons that appear in WorkSpace Navigator under \Generated Code\src\SUP101, and the error in the Problems view: net cannot be resolved.

    The error occurs because the package Java file called by SUP101DB.jar is not yet in the project build path. The errors resolve later, when you build the application in the BlackBerry Java Plug-in for Eclipse.

  7. In the Success dialog, click OK.
    In the Generated Code directory, you see a \src\SUP101 folder.