After migration from SpringBoot 2.7.18 to SpringBoot 3.4.0 and Hibernate 6 I have problem with automatic updating database structure. When I set parameter
spring.jpa.hibernate.ddl-auto=update
I got an error on start:
[PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.exception.JDBCConnectionException: Error accessing column metadata: central.discount_code [This connection has been closed.] [n/a]
but above I see other errors:
09:46:22.380 [main] ERROR o.h.m.internal.MetadataContext - HHH015007: Illegal argument on static metamodel field injection : org.hibernate.envers.DefaultRevisionEntity_#class_; expected type : org.hibernate.metamodel.model.domain.internal.EntityTypeImpl; encountered type : jakarta.persistence.metamodel.MappedSuperclassType
09:46:22.403 [main] INFO o.h.e.t.j.p.i.JtaPlatformInitiator - HHH000489: No JTA platform available (set 'hibernate.transaction.jta.platform' to enable JTA platform integration)
09:46:22.898 [main] WARN c.zaxxer.hikari.pool.ProxyConnection - HikariPool-1 - Connection org.postgresql.jdbc.PgConnection@293ecff6 marked as broken because of SQLSTATE(0A000), ErrorCode(0)
org.postgresql.util.PSQLException: ERROR: cannot alter type of a column used by a view or rule
Szczegóły: rule _RETURN on view central.sn_person_portal_max_date depends on column "osoba_created"
09:46:22.903 [main] WARN o.h.t.s.i.ExceptionHandlerLoggedImpl - GenerationTarget encountered exception accepting command : Error executing DDL "
alter table if exists cn_osoba
alter column osoba_created set data type timestamp(6)" via JDBC [ERROR: cannot alter type of a column used by a view or rule
Szczegóły: rule _RETURN on view central.sn_person_portal_max_date depends on column "osoba_created"]
09:46:22.906 [main] WARN o.h.t.s.i.ExceptionHandlerLoggedImpl - GenerationTarget encountered exception accepting command : Error executing DDL "
alter table if exists cn_osoba
alter column osoba_rabat set data type numeric(38,2)" via JDBC [This connection has been closed.]
Caused by: org.postgresql.util.PSQLException: This connection has been closed.
I'm using PostgreSQL version 13.2 and driver version 42.7.3.
When I was using Spring 2 it worked.
Why Hibernate is changing type of record to timestamp(6), previews versions didn't do it?? Why is get "connection has been closed"?? How to fix it?