>  -Dspring.jpa.show-sql=true
>  -Dspring.jpa.properties.hibernate.hbm2ddl.auto=validate

I believe:

   -Dspring.jpa.properties.hbm2ddl.auto=validate

is allowed, and works, but I see that the proper way is [1], [2] :

  -Dspring.jpa.hibernate.ddl-auto=validate

Let me know if the latter makes a difference. Ideally, the application.yml file should be set to validate by default.

Either way, I think the yml in the properties file should be updated to the proper description/structure:

spring:
  jpa:
    hibernate:
       ddl-auto: validate


[1] http://docs.spring.io/spring-boot/how-to/data-initialization.html
[2] https://vladmihalcea.com/validate-ddl-schema-spring-hibernate/



Fra: Petter Reinholdtsen <pere@hungry.com>
Sendt: fredag 7. mars 2025 12:30
Til: nikita-noark@nuug.no <nikita-noark@nuug.no>
Emne: Re: Nikita Noark5 Core Packaging for java-21-openjdk and systemd-based RPM Systems
 

Here is the updated service file talking to a PostgreSQL-server and
external Keycloak service.

----------------------------------------------------------------------------------------
[Unit]
Description=Nikita Noark 5 service interface
After=network.target nss-user-lookup.target nslcd.service

[Install]
WantedBy=multi-user.target

[Service]
User=ark-nikita-t
ExecStart=java -jar -Dspring.jpa.show-sql=false -Dspring.main.banner-mode=off \
  -Dnikita.startup.base-directory=/opt/nikita/storage \
  -Dspring.security.oauth2.client.provider.keycloak.issuer-uri=https://<redacted>/realms/<redacted> \
  -Dspring.security.oauth2.client.registration.keycloak.client-id=<redacted> \
  -Dspring.profiles.active=postgres \
  -Dspring.datasource.url=jdbc:postgresql://<redacted>/<redacted> \
  -Dspring.datasource.username=<redacted> \
  -Dspring.datasource.password=<redacted> \
  /opt/nikita/target/nikita-noark5-core-0.7.jar
Type=simple
Restart=on-failure
TimeoutStartSec=infinity
----------------------------------------------------------------------------------------

I tried adding these options to enable SQL statement logging and avoid
erasing the database on restart, but it did not work.  Not quite sure
why.  Thomas, any idea?

  -Dspring.jpa.show-sql=true
  -Dspring.jpa.properties.hibernate.hbm2ddl.auto=validate

--
Happy hacking
Petter Reinholdtsen
_______________________________________________
nikita-noark mailing list -- nikita-noark@nuug.no
To unsubscribe send an email to nikita-noark-leave@nuug.no