thomas
thomas

Reputation: 1271

Jhipster - connecting two applications to one database

I have a working Jhipster application, linked to a mysql database.
I would like to create a new application that I would connect to the first application database.

Is it possible? regarding to liquibase/entities/etc.

Upvotes: 0

Views: 764

Answers (1)

Indivon
Indivon

Reputation: 1864

Why should this not be possible? MySQL itself is a multiuser DBMS, so it could handle multiple connections.

The only problem would be liquibase, because it checks if your database is valid against your changelogs. So, if your second app also uses liquibase and has not the same changelogs with same checksums, it will not start. So your second app should not use liquibase and you should remove the liquibase-stuff from the second app. The means: the first app is repsponsible for creating/updating the schema using liquibase and the second app just uses the same schema.

And you're right: the entities must be the same, because hibernate/JPA assumes the same column and entity/table names (which are given by the database)...

In my opinion, a better approach would be the microservice-way: the first application is the only who access the database directly and offers some interfaces for the entities via REST. Then, your second application simply uses the interface via a REST-Client. This also allows you to define other/modified entities via the REST-Service and your second app may not use exactly the same like in the first application.

Upvotes: 4

Related Questions