Is it possible to turn off DDL generation on the class level vs the full application?
I have a reporting app that we have thus far had the setting in application.properties
jpa.generateDdl=false
We effectively have several different views in this app that populate java objects annotated with @Entity
. This works great.
But now we want to add other objects which we DO want to persist.
If I switch on jpa.generateDdl=true
, then it will generate tables for these views, which we want to avoid. Is there a way to prevent this from happening, while still allowing other objects to persist?
CodePudding user response:
No that's not possible.
As written in the Hibernate documentation you shouldn't relay on the feature for production applications.
Although the automatic schema generation is very useful for testing and prototyping purposes, in a production environment, it’s much more flexible to manage the schema using incremental migration scripts.
I would recommend to use Liquibase or Flyway to use for database migrations.