cannot find the sql generated by jhipster create entity - jhipster

I have done setup of jhipster(using video ) and tried to create entity using jhipster. I have not taken any json file as input. To make it simple I have created entity Employee as....
Command yo jhipster:entity Employee
---Employee---
name String
email String
with no validation rules and relationship. Entity creation is successful but I cannot find any .sql file containing the sql command.
I can see respective java files are generated in under src\main\java\com\mycompany\myapp\domain. Any idea where is the sql created?

There are no generated SQL files.
JHipster uses Liquibase for the changes to your Database.
You should have these XML files in src/main/resources/config/liquibase/changelog/, doing the same as SQL files.

Related

DocumentDB Data migration Tool, can't migrate from db to db

I'm using DocumentDB Data Migration Tool to migrate a documentDB db to a newly created documentDB db. The connectionStrings verify say it is ok.
It doesn't work (no data transferred (=0) but not failure written in the log file (Failed = 0).
Here is what is done :
I've tried many things such as :
migrate / transfer a collection to a json file
migrate to partitionned / non partitionned documentdb db
for the target indexing policy I've taken the source indexing policy (json got from azure, documentdb db collection settings).
...
Actually nothing's working, but I have no error logs, maybe a problem of documentdb version ?
Thanx in advance for your help.
After debugging the solution from the tool's repo I figure the tools fail silently if you mistyped the database's name like I did.
DocumentDBClient just returns an empty async enumerator.
var database = await TryGetDatabase(databaseName, cancellation);
if (database == null)
return EmptyAsyncEnumerator<IReadOnlyDictionary<string, object>>.Instance;
I can import from an Azure Cosmos DB DocumentDB API collection using DocumentDB Data Migration tool.
Besides, based on my test, if the name of the collection that we specify for Source DocumentDB is not existing, no data will be transferred and no error logs is written.
Import result
Please make sure the source collection that you specified is existing. And if possible, you can try to create a new collection and import data from this new collection, and check if data can be transferred.
I've faced same problem and after some investigation found that internal document structure was changed. Therefor after migration with with tool documents are present but couldn't be found with data explorer (but with query explorer using select * they are visible)
I've migrated collection through mongo api using Mongichef
#fguigui: To help troubleshoot this, could you please re-rerun the same data migration operation using the command line option? Just launch dt.exe from the same folder as Data Migration Tool for syntax required. Then after you launch it with required parameters, please paste the output here and I'll take a look what's broken.

Is it possible to create services and DTO from existing entity?

I am seeking for a way to create DTO and service automatically from entity. To be more specific I've created some entities and their relationship using JDL-studio and imported using jhipster cli but I didn't found dto and service. Even I tried other option like changing .json file under .jhipster folder but no luck.
Is there any option out there?
Well, I found the solution myself that once the entity is created the entity json file will also automatically created on .jhipster folder and for the service and DTO what we have to do is we've to just put following properties on .json entity.
"dto": "mapstruct",
"service": "serviceImpl",
"microserviceName": "WntVehicleAuthority",
and after that we 've to issue yo jhipster:entity EntityName and it will automatically generate service and dto.
Note only mention Entity name not extension
ie, yo jhipster:entity Employee

Modified entites are not reflecting in database

I have created a Entity for jhipster Microservice Gateway project.
Tried to modify the entity by adding new fields later. Its corresponding Java classes and Angular files got updated. But, the new field is not added in the database table.
Did i miss any other configurations ? Thanks in advance !
the database changes are done by liquibase, i.e. you need to have a look under
src/main/resources/config/liquibase/
for master.xml. JHipster is adding all the scripts that need to be run when you start your app in master.xml.
When you add new fields over comand line, then the generator is modifing your master.xml by adding a new change or is just updating an existing change. All the changes are located under in the folder changelog which is on the same level as master.xml.
I got it now. I failed to add hibernate statement under jpa in application.dev.yml.
I have added " hibernate.hbm2ddl.auto: update" under jpa in application.dev.yml file. And the field got inserted into mysql DB table.

Sequilize/Umzug: where to store a state of a database schema?

So, I want to write an application which use some data migration. Where should I store a current state of db?
For example: I have a production server and my development machine. I wrote an application and 3 migrations for it. When I deploy the application server also runs 3 migrations.
Now I'm going to write the 4th migration. How does server recognize that it need to run only 4th migration and it already run previous 3 migrations?
Ref https://github.com/sequelize/cli
sequelize init:migrations
will generate migration folder where you need to write migrations and
There are three types of storage that you can use: sequelize, json, and none.
sequelize : stores migrations and seeds in a table on the sequelize
database
json : stores migrations and seeds on a json file
none :
does not store any migration/seed

How to preload MongoDB document?

I'm writing a web application with Node and MongoDB (with mongoose) - I have a collection that has a pre-defined data (images links that the users will choose one of them - they set of the images links is closed and won't be changed during the run of the application) and it need to be joined with other collection. I don't know if it is better to create a collection for this or to save the data in a single JSON file. But because i need to join this collection with other collection I decided to save the data in the DB.
Now the question is how I can create the data in the DB once and each time I raise the Node server the data won't be created again? (something like upsert)? and where is the best place to add this method? in the Schema module or where?
Thanks.
I found a way to do it by running an import command before raising the server (or even after the server is up) - I run the following line which will create the new documents or update the exist documents (according to the _id in the JSON file):
mongoimport --db test --collection supported_images --type json --file SupportedImages.json --upsert --jsonArray
Thanks everyone.

Resources