Grant
Grant

Reputation: 41

What is the preferred strategy/workaround for introducing legacy database entities in Jhipster

Is there a good practice to introduce existing legacy database tables/entities into a JHipster project? The idea I had was to create the JPA entities that look exactly like the existing entities and then use the generated artifacts as per normal. Will this possibly work?

Upvotes: 1

Views: 167

Answers (1)

Grant
Grant

Reputation: 41

In the end, I opted for just creating a view of all the underlying tables I needed in my query. The steps I followed were:

  1. create the view on the DB,
  2. Generate the entity using JHipster, with exactly the same fields.
  3. Strip out the Update ad Create and Delete functions and we have a read-only view page with all the data you need and all the fields displaying, done.

Now I can add my own routers and buttons, to allow other specific operations/flow. This page was my inspiration: https://www.javabullets.com/calling-database-views-from-spring-data-jpa/

Upvotes: 2

Related Questions