- • Quickstart
- › Documentation
- • Documentation DevOps
- • Spring Data
- • Spring Data MongoDB
- • Spring REST
- • Multi-Module
- • IntelliJ Integration
Last updated: 2022-07-02
Entity tab - backgrounds
In the Entity tab the database schema for the new Spring Boot application can be created.
The Entity tab with a simple database schema
Initially, there are no entities in a new project. They can be added by clicking on the plus sign. After saving, the future tables are displayed in a UML preview.
When creating or editing an entity, the name can be specified first. This is automatically converted into the correct formatting for the Java class (pascal case "CarPart") and if necessary the table name (snake case "car_part"). If the name is a keyword in the chosen database system, an annotation is added to the table to quote it - e.g.
@Table(name = "\"user\"") in Postgres. If MongoDB is chosen as the database, the entities are created with the
Editing an entity in the Bootify Builder
The option "Add REST Endpoints" automatically generates a Data Transfer Object (DTO), a Service and a Resource class to provide a REST API with simple CRUD operations for the entity. The DTO contains annotations to validate the specified contraints (e.g.
@Size(max = 255)). The option "Add frontend controller" is only available when a frontend has been selected for your application in the General tab. It will add a Controller and required Thymeleaf templates on top. In the Professional plan, an additional option for pagination is available and will be applied to both, REST and frontend controllers.
A total of four types are available for the primary key.
Long (default) are generated by the database via a sequence.
UUID is filled by Hibernate's
UUIDGenerator before the first persistence.
String must always be provided by the application or REST endpoint and, as a primary key, can never be updated.
For the other fields, many more simple types are available, e.g.
LocalDate. In addition, Enums and Data Objects created in the Data Objects tab can be selected. Enums are always written to the database as strings, whereas Data Objects are persisted as JSON fields using the
After the first entity has been created, relations can also be added to the database schema. The available types are One-to-One, Many-to-one, One-to-many and Many-to-many. The field should be described in the singular (e.g. owner), since the plural "s" is automatically added for the many-side. Circular references are possible, but these must not all be required - this would make it impossible to persist any values.
According to the selection made, the appropriate JPA annotations are added. Relations are always loaded with
FetchType.LAZY to avoid oversized queries from Hibernate. However, this can be adjusted after download if needed.
If MongoDB is chosen as the database, relations are added to entities with
@DocumentReference. This way MongoDB uses a manual reference internally, while the developer can access the referenced documents without any detours.
Using the SQL Import of the Free plan, the entities and relations can be created directly from a SQL script. The link "Import Schema" in the Entity tab opens a modal into which the script can be copied.
Paste your SQL script to see a preview
The relevant entries from the script are automatically parsed (starting with
CREATE TABLE /
ALTER TABLE). A preview is displayed in the next step, which can then be copied into the project. Existing entities and relations will be overwritten. The imported entities have the REST option disabled at first.
If the application is to be connected to an existing database later, it is recommended to set the DB Generation to None (validate) in the General tab. This will cause Hibernate to compare the entities with the actual database schema when starting the application and throw an exception if necessary. Minor adjustments are usually still needed here so that the field types can be mapped without errors.
No registration required