Add attributes - edit - delete

Add attributes

  1. Click Add Attribute in the entity editor, enter the name at Name, e.g. company.

  2. At Type select the data type, e.g. String.

  3. Click Save.
    Image not found

  • Attributes - When adding attributes like company, the "Get" method getCompany as well as the "Set" method setCompany are generated in the entity class next to the variable company, with which the variable company is accessed (getter and setter).

    private String company;
    
    public String getCompany() {
        return company;
    }
    
    public void setCompany(String company) {
        this.company = company;
    }
  • Int or Integer - It is recommended to use type classes like Integer for the attributes of your entities, since primitive data types like int cannot take a null value, which is however commonly used in relational databases.

  • Missing Java data types - For the Java data types used in the entities, appropriate database data types are automatically used when generating the database.

Important Properties

Icon Function

image not found

Change to Basic - This is the default setting of all attributes. Therefore the @Basic annotation does not need to be set explicitly.

image not found

Change to Transient - Attributes marked with @Transient are not persisted.

image not found

Change to Version - Marks the attribute as @Version. Version attributes are used for the Optimistic Locking from JPA used

image not found

Change to Id - Attributes marked with @Id are saved as primary keys.

  • Fetch type - The fetch type defines whether the attribute’s data is loaded from the database immediately (eager) or only when needed (lazy). This setting is normally only significant for relations. Hibernate ignores this setting for normal attributes (@Basic) unless, Bytecode Enhancement is enabled. Note that reloading no longer works when the entity objects are detached!

  • Column name - The column name in the database table.

  • Table name - The name of the database table that contains this column. If you specify an alternative table here, it must be assigned to the entity with a @SecondaryTable* - annotation can be specified

  • Insertable - If you set this value to false, the persistence provider (Hibernate) excludes this attribute when generating SQL insert statements.

  • Updateable - If false, the Persistence Provider ignores this attribute during SQL update statements.

  • Unique - If true, a unique constraint is created for this attribute when the database tables are created.

  • Nullable - If this value is set to false, this attribute must not be null when saving or updating the entity. When creating the tables, a NOT NULL constraint is added for this column.

  • Length - The length of the column. This value affects only string values

  • Precision - Concerns only fixed precision numbers. Sets the number of digits for this table column.

  • Scale - Applies only to numbers with fixed precision. Defines the number of decimal places.

  • Column definition - Column definition is exactly the part of the SQL statement generated when creating the tables that describes this column. The Column definition can be used, for example, to use a special (database) data type for this attribute.

  • Type mapping - Predefined annotations to match the mapping between Java data types and data types in the database. For example, the Java data type java.util.Date in an H2 database can then be e.g. date, timestamp or time.

Fetch Type, Insertable, Updatable and @Transient have no equivalent in the database. These settings are relevant when inserting, updating and fetching data from the database.

All other settings are settings that affect the structure of the database. Without Export or Update they have no effect.

Edit attributes

  1. Select the attribute you want to edit.

  2. Make the change and confirm with the Enter key. The source code is automatically generated or edited.

  3. Click Save.

Delete attributes

  1. Select the attribute you want to delete.

  2. Click red cross image Delete

  3. Confirm with OK in the following dialog.
    Image not found

  4. Click Save.