Schema Generation (hbm2ddl) — Concept Check
Questions on Schema Generation (hbm2ddl). spring.jpa.hibernate.ddl-auto controls schema generation: validate (production), update (development), create-drop (tests); use Flyway or Liquibase for production migrations.
Questions in this quiz
8 questions on Schema Generation (hbm2ddl) — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.In a development environment, which ddl-auto setting allows Hibernate to automatically modify the schema to match entity changes?
- Aupdate
- Bcreate-drop
- Cnone
- Dvalidate
2.A team is using Hibernate with ddl-auto set to 'update' in production. What risk does this pose?
- ASchema changes might silently drop columns.
- BHibernate will not validate the schema at all.
- CIt will automatically create a new database.
- DThe application will fail to start if there's a schema mismatch.
3.What is the recommended ddl-auto setting for production environments when using Flyway?
- Avalidate
- Bnone
- Cupdate
- Dcreate-drop
4.A developer wants to ensure that their test database schema is reset before each test run. Which ddl-auto setting should they use?
- Aupdate
- Bnone
- Cvalidate
- Dcreate-drop
5.Which ddl-auto setting completely disables Hibernate's schema management, allowing exclusive use of Flyway or Liquibase?
- Avalidate
- Bupdate
- Cnone
- Dcreate
6.A team using Flyway for migrations notices that a migration script runs twice. What likely went wrong?
- AThe script wasn't versioned correctly.
- Bddl-auto was set to 'validate'.
- CFlyway was not enabled in the configuration.
- DThe schema was not validated before running.
7.A developer mistakenly believes that using 'create-drop' in production is safe because it ensures a fresh schema. Why is this incorrect?
- AIt only works in development environments.
- BIt will drop the entire database on shutdown.
- CIt doesn't validate the schema against entities.
- DIt requires manual intervention to run.
8.What is a potential downside of using 'update' mode in a development environment?
- AIt disables schema validation.
- BIt will not apply any schema changes.
- CIt can rename columns incorrectly.
- DIt prevents Flyway from running.