JHipster code review for generated Prelegent entity

Hi All,
today we will take a quick look at code generated with JHipster. Is console generator our friend? What JHipster can generate for us?

Last week we had generated basic entity Prelegent using command line generator. Now I’d like to show you how look like the code responsible for those functionalities. When I was testing some other generators like Spring Roo, it drew my attention to the fact that generated code was simply unclear, with lots of Aspects and hard to be modified.

In JHipster I think code is much better and more clear than in other solutions. You can choose most of technologies, starting from backend (REST, dao/dto), to frontend (Angular 1, Angular 2, React, Vue), searching (standard with DB, elasticsearch). On the end of this project we will see is it worth to be mentioned.

Main panel

Getting back to our application. Starting from main page, generator has added our entity to the list of entities.

How it looks in java

What we got is base domain entity Prelegent with implemented communication logic via REST for Angular. JHipster generated for us basic repository class which extends generic basic Spring Data JPA CRUD operations. Please take a look below, code is quite clean and gets positive impression for developer, who will need to use and extend it 😉

REST resource file:

List of Prelegents

Generated controller for Prelegent entity:

You can display data with HTML template:

Routing file for Angular 1 with handling state changes:

Searching mechanism

For the beginning we have our basic Repository and SearchReposotiry classes. First one is is based on Spring Data JPA with it’s pros as JpaRepository parent class:

And ElasticSearch implementation of searching mechanism:



For generated entity we also was given by Authors with lots of tests. From java perspective we have test if entity resource works:

From js perspective we have some end to end test:

And js controller test:

And last, but not least: performance testing in gatling! Really!

All of this is out of the box! How much time do you need to write that logic, tests, make it works and document little bit? Remember, that you can see here entity with only few fields. In target generated application you will have much more code to write. Using JHipster you can save your time and money, and hopefully implement your business logic in that time.



JHipster entity configuration

Our generator saved us also json file with configuration of generated files structure and relations. You can modify it, extend, add some more json file to next entities and you will have here base configuration of your modular application.

Liquidbase and i18n

You also have got update in changelog of liquidbase – to remember about database structure. You got configured cache for new entity, internationalizations for JHipster (i18n generated in every language you provided). JHipster gave you 29 files in java, javascript, scala, json, xml and html to faster your work and give you an opportunity for bigger benefits of your work.


This entry is quite long because of the code, but most of you won’t be able, have time or opportunity to test it or take a look at github. In this post you gets all JHipster files shown in one place. You can analyse how it looks like, if you would like to work with such code. For me it looks pretty good, so in next blog post we will see how to use JDL and generate big backbone of our application.


No votes yet.
Please wait...
Paweł Dobrzański

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

You may also like

Bądź na bieżąco na FB!


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!


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.

Najpopularniejsze posty