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.
-
In the Data Model section of the CUBA project tree click New → Entity. The New CUBA Entity dialog window will appear.
-
Enter the name of the entity class –
Tip
– in the Entity name field, chooseNot persistent
for Entity type and click OK button. The entity designer page will be displayed in the workspace. -
Using Entity Designer add attributes:
-
row
of the typeInteger
-
totalBill
of the typeDouble
-
sex
of the enum typeSex
-
smoker
of the enum typeSmoker
-
day
of the enumDay
-
time
of the enumTime
-
size
of the typeInteger
-
tip
of the typeDouble
-
-
Switch to the Text tab. It contains the source code of the
Tip
class.
Tip
entity creation is now complete.