Create model and CRUD with JHipster terminal generator


Hey, today we will focus on generating application model. JHipster gives us an opportunity to create it veeery fast.  Generates all needed class files and view in angular (or other framework which you will choose).

During creating model with JHipster you are choosing how should looks like your entity. You need to type entity name, field name, types, restrictions (minValue, maxValue, etc), relations to other entities, pagination if needed, generating DTO and service class for your logic. Bunch of files at the beginning, isn’t it? So what way are available for creating all those files?

Methods of generating model in JHipster

1. Using command line

Generator is asking all questions one by one. It uses default values when you press enter. You need to remember that if you have any relation in your main entity, you need to generate the second entity before you invoke it in main one. Seems logic, generator needs to know the second one 😉

If you pass the whole generation process, it will list you all added files. Then you need to rebuild project and new structures will be available!

2. Using free online tool

You can buidl you ERD model in JDL studio. What you type will be visualised in the scheme on the right. You can define there all informations, including relations, paginations, and many more. Then you need to export JDL file and read it via command line using tutorial from documentation.

3. Using UML schema

You can generate model from diagram using JHipster-UML which supports many formats.

 

Genertion of files lasts very quickly and the results looks like the one below:

On .jhipster folder in the root folder you will find json files corresponding to entities which was created by you. In that json files you can modify field names, relations or other configurations. After that you need to regenerate entity using our favorited command:

I need to spend some time on preparing model for this project. Maybe this weekend will be more generous than the one before 🙂

Rating: 5.0. From 1 vote.
Please wait...
Paweł Dobrzański

Start-up's fan, technological conferences member, social media enthusiast and low-cost trips traveler.

You may also like

Więcej niż na blogu

Cześć!

Witaj na moim blogu! Znajdziesz tu proces budowania mojej aplikacji EventSearch za pomocą jhipstera. Podzielę się z Tobą niuansami dot. zakładania i prowadzenia firmy. Mam również nadzieję, że pomogę Ci zaoszczędzić trochę pieniędzy. Zapraszam!

Promocja na helionie!

Spring w akcji. Wydanie IV

autor: Craig Walls

Cena: 89.00 zł
(Cena e-booka: 71.20 zł)

Najpopularniejsze posty

Dzięki, że wpadłeś!

Paweł Dobrzański

Paweł Dobrzański

Start-up's fan, technological conferences member, social media enthusiast and low-cost trips traveler.