Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Attribute hinzufügen

  1. Klicken Sie im Entity-Editor auf Add Attribute, geben Sie bei Name die Bezeichnung ein, z.B. company
  2. Wählen Sie bei Type den Datentyp aus, z.B. String.
  3. Klicken Sie auf Speichern.
    Image Removed
Hinweis:

...

Adding attributes

  1. Click Add Attribute in the entity editor, and enter the name in name, e.g. company.
  2. Select the data type in Type, e.g. String.
  3. Click Save.
    Image Added
Note:
  • Attribute - When adding attributes like company, the variable company, the getCompany Get method as well as the setCompany Set method are generated in the entity class by which the company variable is accessed (getter and setter).

    Code Block
    languagejava
    themeConfluence
    private String company;
    
    // Returns the attribute
    public String getCompany() {
    	return company;
    }
     
    // Sets the attribute
    public void setCompany(String attribute) {
    	this.company = attribute;
    }
  • Int oder Integer - Es ist empfehlenswert für die Attribute Ihrer Entities Typ-Klassen wie Integer zu verwenden, da primitive Datentypen wie int keinen Null Wert annehmen können, der jedoch in relationalen Datenbanken häufig verwendet wird.
  • Fehlende Java Datentypen - Für die in den Entities verwendeten Java Datentypen werden beim Generieren der Datenbank automatisch entsprechend geeignete Datenbank Datentypen verwendet. 
Wichtige Properties:

...

Icon

...

  • You are advised to use type classes such as integer for the attributes of your entities, since primitive data types like int cannot assume a null value and such a value is frequently used in relational databases.
  • Missing Java data types: In the process of the database generation, the data types that are suitable for the database are automatically used for the Java data types used in the entities. 
Important properties:

...

Icon

Function

Change to Basic - Dies ist die Standard-Einstellung aller Attribute. Deshalb muss die @Basic Annotation nicht explizit gesetzt werdenThis is the default setting of all attributes. Therefore, the @Basic annotation does not need to be explicitly set.

Change to to Transient - Mit @Transient markierte Attribute werden nicht persistiert Attributes labeled with @Transient are not persisted.

Change to Version - Markiert das Attribut als @Version. Versions-Attribute werden für das Optimistic Locking von JPA verwendet

...

Labels the attribute with @Version. Version attributes are used for the optimistic locking of JPA.


  • Fetch type -  The fetch type defines whether the data of the attribute is loaded from the database immediately (eager) or when needed (lazy). Normally, this setting is important only for relations. Hibernate ignores this setting in normal attributes (@Basic) unless bytecode enhancement is enabled. Note that the re-loading process no longer works once the entity objects are detached.
  • Column name - Name of the database table.
  • Table name - Name of the database table that contains this column. If you specify an alternative table here, you will need to annotate the entity with @SecondaryTable.
  • Insertable -  If you set this value to false, the persistence provider (Hibernate) excludes this attribute when generating SQL insert statements.
  • Updateable - If you set this value to false, the persistence provider ignores this attribute in SQL update statements.
  • Unique - If you set this value to true, a unique constraint is generated when you create the database table for this attribute.
  • Nullable - If this value is set to false, this attribute cannot 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 applies only to string values.
  • Precision - Applies only for numbers with a fixed accuracy. Specifies the number of digits for this table column.
  • Scale - Applies only for numbers with a fixed accuracy. Specifies the number of decimal places.
  • Column definition -  The column definition is exactly the part of the SQL statement that describes this column. The SQL statement is generated when you create the tables. Using this column definition you can, for example, use a special (database) data type for this attribute.
  • Type mapping - Predefined annotations to customize the mapping between Java data types and data types in the database. Thejava.util.Date Java data type in an H2 database can, for example, be date, timestamp or time.

...

Fetch Type, Insertable, Updateable und @Transient haben keine Entsprechung in der Datenbank. Diese Einstellungen sind beim Einfügen, Aktualisieren und Holen von Daten aus der Datenbank relevant.

Alle anderen Einstellungen sind Einstellungen, die die Struktur der Datenbank betreffen. Ohne Export oder Update haben sie keine Auswirkungen.

Attribute editieren

  1. Selektieren Sie das Attribut, das Sie editieren möchten.
  2. Führen Sie die Änderung durch und bestätigen Sie mit der Eingabetaste. Der Quellcode wird automatisch erzeugt bzw. editiert. 
  3. Klicken Sie auf Speichern.

Attribute löschen

...

,and @Transient have no match in the database. These settings are relevant when inserting, updating, and retrieving data from the database.

All other settings are related to the structure of the database. Without export or update they have no effect.

Editing attributes

  1. Select the attribute you want to edit.
  2. Make the changes and confirm by clicking Enter. The source code is automatically generated and edited.
  3. Click Save.

Deleting attributes

  1. Select the attribute that you want to delete.
  2. Click Image AddedDelete.
  3. In the following dialog, confirm by clicking OK.
  4. Click Yes in the following dialog, to delete the getters and setters of the attribute, too. By default, they will not be deleted.
    Image Added
  5. Click Save.