Dmitry Popov (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *commented* on HHH-15806 (
https://hibernate.atlassian.net/browse/HHH-15806?atlOrigin=eyJpIjoiNmFhND...
)
Re: Envers and Hibernate 6 and PostgreSQLEnumType (
https://hibernate.atlassian.net/browse/HHH-15806?atlOrigin=eyJpIjoiNmFhND...
)
Please fix it, it breaks the migration to Spring Boot 3 + Hibernate 6.1.5, if you have an
application with PSQL database, audited entities, and enum fields saved as PSQL enum data
type!
The issue is — the 2nd run on PostgreSQLEnumType does NOT pass this property in the
parameters:
org.hibernate.type.ParameterType.xproperty -> {JavaXProperty@14294}
"country"
Which results in a Spring Boot application failing like this:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name
'entityManagerFactory' defined in class path resource
[org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Cannot
read the array length because "<local3>" is null
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1751)
~[spring-beans-6.0.2.jar:6.0.2]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599)
~[spring-beans-6.0.2.jar:6.0.2]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521)
~[spring-beans-6.0.2.jar:6.0.2]
at
org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
~[spring-beans-6.0.2.jar:6.0.2]
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
~[spring-beans-6.0.2.jar:6.0.2]
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
~[spring-beans-6.0.2.jar:6.0.2]
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
~[spring-beans-6.0.2.jar:6.0.2]
at
org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1130)
~[spring-context-6.0.2.jar:6.0.2]
at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:905)
~[spring-context-6.0.2.jar:6.0.2]
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584)
~[spring-context-6.0.2.jar:6.0.2]
at
org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
~[spring-boot-3.0.0.jar:3.0.0]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730)
~[spring-boot-3.0.0.jar:3.0.0]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432)
~[spring-boot-3.0.0.jar:3.0.0]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
~[spring-boot-3.0.0.jar:3.0.0]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302)
~[spring-boot-3.0.0.jar:3.0.0]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1291)
~[spring-boot-3.0.0.jar:3.0.0]
at com.myapp.adapter.cli.SpringBootInitializer.main(SpringBootInitializer.java:19)
~[classes/:?]
at
jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
~[?:?]
at java.lang.reflect.Method.invoke(Method.java:578) ~[?:?]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
~[spring-boot-devtools-3.0.0.jar:3.0.0]
Caused by: java.lang.NullPointerException: Cannot read the array length because
"<local3>" is null
at org.hibernate.type.EnumType.getAnnotation(EnumType.java:238)
~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
at org.hibernate.type.EnumType.getEnumType(EnumType.java:229)
~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
at org.hibernate.type.EnumType.setParameterValues(EnumType.java:137)
~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
at
com.vladmihalcea.hibernate.type.basic.PostgreSQLEnumType.setParameterValues(PostgreSQLEnumType.java:46)
~[hibernate-types-60-2.21.1.jar:?]
at org.hibernate.mapping.MappingHelper.injectParameters(MappingHelper.java:70)
~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
at org.hibernate.boot.model.TypeDefinition.createResolution(TypeDefinition.java:161)
~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
at org.hibernate.boot.model.TypeDefinition.createLocalResolution(TypeDefinition.java:299)
~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
at org.hibernate.mapping.BasicValue.interpretExplicitlyNamedType(BasicValue.java:681)
~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
at org.hibernate.mapping.BasicValue.buildResolution(BasicValue.java:353)
~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
at org.hibernate.mapping.BasicValue.resolve(BasicValue.java:315)
~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
at org.hibernate.mapping.BasicValue.resolve(BasicValue.java:305)
~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
at
org.hibernate.boot.internal.InFlightMetadataCollectorImpl.lambda$processValueResolvers$4(InFlightMetadataCollectorImpl.java:1767)
~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
at java.util.ArrayList.removeIf(ArrayList.java:1682) ~[?:?]
at java.util.ArrayList.removeIf(ArrayList.java:1660) ~[?:?]
at
org.hibernate.boot.internal.InFlightMetadataCollectorImpl.processValueResolvers(InFlightMetadataCollectorImpl.java:1766)
~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
at
org.hibernate.boot.internal.InFlightMetadataCollectorImpl.processSecondPasses(InFlightMetadataCollectorImpl.java:1752)
~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
at
org.hibernate.boot.internal.InFlightMetadataCollectorImpl.buildMetadataInstance(InFlightMetadataCollectorImpl.java:2292)
~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
at
org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:349)
~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
at
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1350)
~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
at
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1421)
~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
at
org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:66)
~[spring-orm-6.0.2.jar:6.0.2]
at
org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:376)
~[spring-orm-6.0.2.jar:6.0.2]
at
org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409)
~[spring-orm-6.0.2.jar:6.0.2]
at
org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396)
~[spring-orm-6.0.2.jar:6.0.2]
at
org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:352)
~[spring-orm-6.0.2.jar:6.0.2]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1797)
~[spring-beans-6.0.2.jar:6.0.2]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1747)
~[spring-beans-6.0.2.jar:6.0.2]
... 19 more
The related issue in the library providing the PostgreSQLEnumType is here —
https://github.com/vladmihalcea/hypersistence-utils/issues/519 (
https://github.com/vladmihalcea/hypersistence-utils/issues/519 ).
(
https://hibernate.atlassian.net/browse/HHH-15806#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-15806#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100213- sha1:b01baad )