Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: hibernate schema validate config is not set #19219

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vietnguyen
Copy link
Contributor

@vietnguyen vietnguyen commented Nov 19, 2024

Issue

  • We have the config connection.schema and default value is validate which means hibernate will throw an error on startup if a new property doesn’t exist in database. For example:
    Caused by: org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: missing column [test] in table [organisationunit]
  • However currently this is not working because the property is not set correctly.
  • When value is update then hibernate will auto generate tables. This is only used in H2 test.
  • Note that you will also get a postgresql exception for insert/select non exist column in database.
  • This only affects 2.41 and 2.42. Before that we didn't use the HibernateJpaAdapter and set the property directly to Hibernate Session Factory.

Fix

  • Set the property AvailableSettings.HBM2DDL_AUTO with value taken from dhis config connection.schema

Copy link

sonarcloud bot commented Nov 19, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants