change database PostgreSQL to MySQL - jhipster

I'm very new to coding world so I hope I will be clear in my request.
I would like to know if in an Jhipster generated app, I can change the prodDatabaseType from PostgreSQL to MySQL directly in the file .yo-rc.json without the need to generate de novo an other JHipster app?
I have another naive question. Does Spring JPA handle the request for MySQL and PostgreSQL the same way?

Re-generating with MySQL (after modifying .yo-rc.json) will change few properties in application*.yml, pom.xml or build.gradle, docker files, Liquibase xml changelogs and ID generation type in JPA entities.
Knowing this, you should be able to easily merge these changes using git.

Related

Generate front-end based on database or java model

I need to migrate the front-end of an application to angular. I want to use jhipster and reuse all existing java back-end and database. My questions are:
Is it possible to generate the front-end based on java model or i need to have the JDL files?
Is it possible to generate JDL files from the java model or from the database schema?
Thank you for your help.
No
No even though there has been some attempt like https://github.com/bastienmichaux/generator-jhipster-db-helper but I don't think it will go far enough for you
Thank you for your help.
I found another approach to generate the JDL files based on the database:
https://github.com/Blackdread/sql-to-jdl
I will try it.

Is there a way to generate jHipster code without the Liquibase? Or to Disable the Liqibase ? JHipster 4.7.0

Is there a way to generate jHipster code without Liquibase?
Or Is there a jHipster generator for database scripts in some kind of separate project of database scripts like in Oracle, MySQL, P SQL etc.
What I mean is Liqibase does not meet my needs, like I want to create tablespaces for my Oracle DB, create a user and grant privileges to it and then create my SQL scripts with in pure SQL not in Liquibase XML file as I want my table data to reside in my tablespace and want to specify the size of columns based on my requirements. And when I'm done with creating the SQL file I just have to run the jar file for all the DB work.
If there is not an option for generating schema without Liquibase. I'm considering disabling the Liquibase and generate the tables manually. Can I disable the Liqibase? There are some online suggestions but for jHipster 3.12 but I have not tried it yet.
Disable Liquibase temporarily in JHipster 2.26
Yes you can use the no-liquibase profile (here is the documentation), and Liquibase will not run anymore
However, JHipster will still generate the Liquibase files for you: you can just ignore them, or even delete them
I personally often use that profile, even if I use Liquibase a lot, as this speeds up deployment (of course, I only use it when I don't modify my database, but I'm not modifying it all the time). So this is nice trick to know, whether you like Liquibase or not.
Then, I'm pretty sure you can do your database-specific scripts with Liquibase, or run them before Liquibase, so maybe this is another solution you could use.

jhipster - how to load data from a database and show data?

I'm learning JHipster and a beginner (web developper).
Can someone show me step by step for loading data in a database (h2 or mysql or oracle) within JHipster application and showing to the home page?
Thanks in advance,
First, you should look at the jhipster documentation to generate an app : see this 12 minute video tutorial
Jhipster actually does a lot for you, it generates the back-end with your classes, logging, database interfacing ... But also creates a nice-looking front-end for you.
Next you should have a database up and running. In the choices you have mentioned, I think Mysql could be the most interesting for a beginner as you would have a good visibility on your database (h2 is mostly in memory, I use it for testing on my app) and the install should be simple enough.
In order to do that, you could use docker or install it manually.
For docker, you just have to type the following command :
docker run -p 3306:3306 --name mysql_instance_01 -e MYSQL_ROOT_PASSWORD=pass -d mysql
And then if you want to stop it :
docker stop mysql_instance_01
See the docker documentation for more information about install and usage : this link
To connect and administrate your database graphically, you can use dbeaver, it is free and easy to use.
Once you have generated the app and the database is running, you have different options : either you add your 'entities' and manually populate your database, or you create an SQL script to do it for you (Which is specific to the database you're using).
JHipster is using liquibase which will automatically translate the entities created in Jhipster into your database.
This is a short introduction, I strongly advise you read the jhipster documentation. For example, this video shows what Jhipster can do and how to use it.
Hope this helps.
You can read this link, a basic jhipster example

How to modify template in jHipster entity subgenerator for angular2?

I have got some work to modify default html generated by Jhipster for Angular2 more specifically,i want to modify styles for grid generated by Jhipster for Entity's.
I have gone through tutorial creating module in Jhispter documentation.
https://jhipster.github.io/modules/creating-a-module/
generator for creating subgenerator is also their can someone please give me pointers on this problem?
e.g
yo jhipster:entity Author
from above command jhipster creates all necessary files at server and client like JPA Entity,REST controller,Service, at client side it creates CRUD UI for Author entity using Angular2(i opted for anular2)
I want to modify client generation Code, i just want to modify HTML templates which gets generated by jhipster entity sub:generator
you need to run Yarn and start modifying your author.component.html
which will automatically refreshed in your Browser.
https://jhipster.github.io/development/
You could also consider using git prior to running the generator and then reverting the server side code once the generator has ran

How to remove db initialization and connection step/code from JHipster microservice app?

I have created java microservices app using JHipster with options jwt, mysqldb, elastic search etc.., I want to remove db related stuff. I just want to use this searvice for indexing user given data to elastic search and apply search on it.
I'm new to java and so need help to remove db related stuff from this kind of app. Please help
You can try to edit .yo-rc.json file from your project, and change "databaseType": "sql" to "databaseType": "no" and re-generate your app using yo jhipster but there's no guarantee that it will work as "no db + ElasticSearch" is probably not a supported use case.
You may have also to remove "devDatabaseType" and "prodDatabaseType".
To be safer, you should rather copy your modified .yo-rc.json file to an empty directory and run yo jhipster from there.

Resources