1.5.2.1. Creating an Entity
  1. Open the Entities tab in CUBA Studio and click New entity button.

  2. In the New entity dialog type CountryGrowth in the Class name field, choose Not persistent for Entity type and click OK button.

  3. Using Entity Designer add attributes:

    • country of the type String

    • year2014 of the type Double

    • year2015 of the type Double

  4. Open the Source tab to see generated source code:

    package com.company.sampler.entity;
    
    import com.haulmont.chile.core.annotations.MetaClass;
    import com.haulmont.chile.core.annotations.MetaProperty;
    import com.haulmont.cuba.core.entity.AbstractNotPersistentEntity;
    
    @MetaClass(name = "sampler$CountryGrowth")
    public class CountryGrowth extends AbstractNotPersistentEntity {
    
        @MetaProperty
        protected String country;
    
        @MetaProperty
        protected Double year2014;
    
        @MetaProperty
        protected Double year2015;
    
        public void setCountry(String country) {
            this.country = country;
        }
    
        public String getCountry() {
            return country;
        }
    
        public void setYear2014(Double year2014) {
            this.year2014 = year2014;
        }
    
        public Double getYear2014() {
            return year2014;
        }
    
        public void setYear2015(Double year2015) {
            this.year2015 = year2015;
        }
    
        public Double getYear2015() {
            return year2015;
        }
    }

    This class describes non-persistent entity. An instance of this class contains the number of the country GDP growth rate for 2014 and 2015 years.

  5. Click OK button to save the entity and close the designer screen.

  6. In the Entities tab click Generate DB scripts button and save scripts.

  7. Create the application database by selecting RunCreate database.