4.1.1.1. Creating an Entity

First, let’s create enumerations. In the Data Model section of the CUBA project tree click New → Enumeration and create the following enumerations:

  • Sex with values: MALE, FEMALE

  • Smoker with values: YES, NO

  • Day with values: SUN, MON, TUE, WED, THU, FRI, SAT

  • Time with values: DINNER, LUNCH

Let’s create the Tip entity class.

  1. In the Data Model section of the CUBA project tree click New → Entity. The New CUBA Entity dialog window will appear.

  2. Enter the name of the entity class – Tip – in the Entity name field, choose Not persistent for Entity type and click OK button. The entity designer page will be displayed in the workspace.

  3. Using Entity Designer add attributes:

    • row of the type Integer

    • totalBill of the type Double

    • sex of the enum type Sex

    • smoker of the enum type Smoker

    • day of the enum Day

    • time of the enum Time

    • size of the type Integer

    • tip of the type Double

  4. Switch to the Text tab. It contains the source code of the Tip class.

Tip entity creation is now complete.