A JHipster module for already existing databases

Usage no npm install needed!

<script type="module">
  import generatorJhipsterDbHelper from '';



NPM version Build Status Dependency Status Join the chat at

This is a JHipster module, meant to be used in a JHipster application.

JHipster was created with the purpose to generate pristine new applications. It enforces conventions which makes it hard to use it with messy existing databases. However some of us still want create a JHipster applications with such databases. generator-jhipster-db-helper makes it easy.


  1. Install our module from JHipster Marketplace or using your favourite package manager.

yarn add generator-jhipster-db-helper

  1. Run the main generator on your already created JHipster application.

yo generator-jhipster-db-helper

  1. Answer our module's questions after creating or regenerating an entity

dbh-1 1 0-demo-questions

Our module do all the necessary modifications (see below some of them)

dbh-1 1 0-demo-entity-git-diff

  1. Profit

Check this application to see all the modifications our module do.



As this is a JHipster module, we expect you have JHipster and its related tools already installed:

Create a new JHipster app and choose a SQL database.

With Yarn

To install this module: yarn global add generator-jhipster-db-helper

To update this module: yarn global upgrade generator-jhipster-db-helper

With NPM

To install this module: npm install -g generator-jhipster-db-helper

To update this module: npm update -g generator-jhipster-db-helper

How this module works

Upon running the main generator, it changes the naming convention to a more flexible one, registers itself as a post app hook and registers the 'fix-entity' sub-generator as a post-entity hook.

When you create or regenerate an entity, the sub-generator fix-entity will run after jhipster:entity has finished running. It receives information from jhipster:entity and uses it to find out what must be modified.

It asks the user what values it must use as replacements for the entity and liquibase files with. It offers jhipster default values or user previous values if any as default answers.

It then match correspond values and replaces them with user input using regexes.

It stores your answer in the entity configuration file .jhipster/Entity.json and makes the necessary replacements in both ORM and changelog files.



  1. Set up your local copy
    1. Fork this module
    2. Clone your fork on your working machine
    3. Install dependencies by running yarn
    4. Create a branch from master (see section Branching below)
    5. Develop new stuff
  2. Use your local copy
    1. Register your local copy by running yarn link inside your clone directory
    2. Create an application to test your modifications
    3. Link the application with your local copy by running yarn link generator-jhipster-db-helper inside your application directory
    4. Use the module (see section Usage above)

You can edit your local repository and test the changes in the application directly. There is no need to rebuild the app.

An easy way to get an application with many entities and all relationship types is to:

  1. Copy the whole travis directory.
  2. Edit the script to modify JHIPSTER_VERSION variable.
  3. Run the script from the travis directory, not the test-case directory.
  4. The application will be created inside the test-case


When submitting changes, please do so from a new branch, not the master branch. Please name your branch according these rules :

  • descriptive name : fork is bad, bugfix/entity-name-validation is good.
  • all characters must be lowercase
  • use dash - as a word separator.
  • use a prefix to describe the branch's type :
    • feature/ : New thing or improvement
    • bugfix/xx- : Repairing something that wasn't working correctly
      • replace xx with the number of the issue. Always open an issue about discovered bugs.

Integration testing

We use Travis CI for integration testing. If you want our module to support another type of database, another application configuration or another set up of entities, the first thing you should do is adding your test case to the travis build.

General guidelines

We aligned ourselves on the guidelines of jhipster/generator-jhipster, if you don't know them, please read them.


Join the chat at


Apache-2.0 © Adrien Horgnies & Bastien Michaux