0

I have a model.jdl with all entities defined like

entity A{ ... }
entity B{ ... }
entity C{ ... }
entity D{ ... }

and I added some options to distribute this entities in microservices with sometime like this:

microservice A,B with gateway 
microservice C with app1
microservice D with app2

when I run the "yo jhipster:import-jdl model.jdl" command in the gateway folder, the liquibase's changelog don't include the entities A and B.

If I run the import in the apps folders, the liquibase changelog show all entities ignoring the distribution defined

I tested the model in a monolithic app without the microservices options and works well...

Here a model for test:

entity Car{
    name String required
    color Color
}

enum Color{
    BLACK,WHITE,BLUE,GREEN,YELLOW
}

entity House{
    address String required
}

entity Info{
    phone String required
}

relationship OneToOne{
    Info{user(login) required} to User
}

microservice Info with gateway
microservice Car with app1
microservice House with app2
search * with elasticsearch
Mohsen
  • 4,536
  • 2
  • 27
  • 49

1 Answers1

3

Your problem here lies in the with microservice gateway. This is not doing what you think it does.

The microservice keyword is actually used to hint the generator that back-end files should be generated on the microservice and the corresponding front-end files should be generated on the gateway with the correct "URL path prefix". This way you can use the same jdl file for both the microservice and the gateway. On the microservice the keyword is ignored but on the gateway it will prevent back-end files from being generated as well as correctly setup the entity front end to call /microservice/api.

What you want is simply to generate a regular entity on your gateway, so just remove the with microservice gateway line.

If you think that our docs should be improved in this area please submit a PR to JHipster/JHipster.github.io.

Pierre Besson
  • 740
  • 3
  • 6
  • Thanks for that answer, I just remove the line and the changelog for the microservices still include all tables... – Marco Nuñez Aug 02 '17 at 21:32
  • I Think that there is an issue, I just reported in the GitHub repo... https://github.com/jhipster/generator-jhipster/issues/6193 – Marco Nuñez Aug 02 '17 at 21:49