I thought it is never too late for this.
I read this post and tried out an auto-generation script, based on that post's instructions and the links in it, to generate my entities.
My sample script below creates a "book" entity.
Instructions:
- Create in the project directory, a batch file with extension .cmd
and as content the script below.
- Open a Windows console (Console 1) with "cmd" command.
- CD to your JHipster project directory.
- Open a second console (Console 2).
- CD to your JHipster project directory as above.
- Run the script in Console 2.
- Immediately click the titlebar of Console 1, for it to get the
focus.
You will see your book entity being created.
From there you may manually edit an entity's JSON file and re-run (this time manually!!) the "yo jhipster:entity" command for that entity.
You may put all your entities with all fields and relations in the script and enjoy the ride.
It might be very useful if you have a UML tool produce a script like this.
The pings are to pause the input being send to the console windows with the focus, because the command "yo jhipster:entity" takes some time to present the first prompt and some times also the others.
@if (@CodeSection == @Batch) @then
@echo off
rem Use %SendKeys% to send keys to the keyboard buffer
set SendKeys=CScript //nologo //E:JScript "%~F0"
rem set SendKeys=CScript //nologo //E:JScript
rem Start the other program in the same Window
start "" /B cmd
ping -n 12 -w 1 127.0.0.1 > NUL
%SendKeys% "yo jhipster:entity book{ENTER}"
ping -n 2 -w 1 127.0.0.1 > NUL
%SendKeys% "{Y}{ENTER}"
ping -n 2 -w 1 127.0.0.1 > NUL
%SendKeys% "name{ENTER}"
ping -n 2 -w 1 127.0.0.1 > NUL
%SendKeys% "{ENTER}"
ping -n 2 -w 1 127.0.0.1 > NUL
%SendKeys% "{Y}{ENTER}"
ping -n 2 -w 1 127.0.0.1 > NUL
%SendKeys% " "
ping -n 2 -w 1 127.0.0.1 > NUL
%SendKeys% "{DOWN}"
ping -n 2 -w 1 127.0.0.1 > NUL
%SendKeys% " "
ping -n 2 -w 1 127.0.0.1 > NUL
%SendKeys% "{DOWN}"
ping -n 2 -w 1 127.0.0.1 > NUL
%SendKeys% " "
ping -n 2 -w 1 127.0.0.1 > NUL
%SendKeys% "{ENTER}"
ping -n 2 -w 1 127.0.0.1 > NUL
%SendKeys% "4{ENTER}"
ping -n 2 -w 1 127.0.0.1 > NUL
%SendKeys% "64{ENTER}"
ping -n 2 -w 1 127.0.0.1 > NUL
%SendKeys% "N{ENTER}"
ping -n 2 -w 1 127.0.0.1 > NUL
%SendKeys% "N{ENTER}"
ping -n 2 -w 1 127.0.0.1 > NUL
%SendKeys% "{ENTER}"
goto :EOF
@end
// JScript section
var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.SendKeys(WScript.Arguments(0));