영재 신 (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=61726d9...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiNzY2NzBjM2E3...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-15624?atlOrigin=eyJpIjoiNzY2Nz...
) HHH-15624 (
https://hibernate.atlassian.net/browse/HHH-15624?atlOrigin=eyJpIjoiNzY2Nz...
) AttributeConverter with SpringBoot causing error after 6.1.1 (
https://hibernate.atlassian.net/browse/HHH-15624?atlOrigin=eyJpIjoiNzY2Nz...
)
Issue Type: Bug Affects Versions: 6.1.4 Assignee: Unassigned Attachments: demo.zip
Components: hibernate-entitymanager Created: 25/Oct/2022 02:57 AM Environment: Spring Boot
3.0.0 RC1
JDK 17 Priority: Major Reporter: 영재 신 (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=61726d9...
)
Hi I am testing Spring Boot 3.0.0 for later usage.
I was making some small project using Spring + JPA Hibernate.
From Spring Boot 3.0.0 M4 which used Hibernate ORM 6.1.1,
There was no problem using @AttribueConverter for collection of Enum Type.
Since 3.0.0 M5 and RC that used later version 6.1.1,
I encountered below error on start up of application.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name
'entityManagerFactory' defined in class path resource
[org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: class
sun.reflect.generics.reflectiveObjects.WildcardTypeImpl cannot be cast to class
java.lang.reflect.ParameterizedType
(sun.reflect.generics.reflectiveObjects.WildcardTypeImpl and
java.lang.reflect.ParameterizedType are in module java.base of loader
'bootstrap')
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1753)
~[spring-beans-6.0.0-RC2.jar:6.0.0-RC2]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599)
~[spring-beans-6.0.0-RC2.jar:6.0.0-RC2]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521)
~[spring-beans-6.0.0-RC2.jar:6.0.0-RC2]
at
org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
~[spring-beans-6.0.0-RC2.jar:6.0.0-RC2]
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
~[spring-beans-6.0.0-RC2.jar:6.0.0-RC2]
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
~[spring-beans-6.0.0-RC2.jar:6.0.0-RC2]
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
~[spring-beans-6.0.0-RC2.jar:6.0.0-RC2]
at
org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1131)
~[spring-context-6.0.0-RC2.jar:6.0.0-RC2]
at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:906)
~[spring-context-6.0.0-RC2.jar:6.0.0-RC2]
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584)
~[spring-context-6.0.0-RC2.jar:6.0.0-RC2]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730)
~[spring-boot-3.0.0-RC1.jar:3.0.0-RC1]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432)
~[spring-boot-3.0.0-RC1.jar:3.0.0-RC1]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
~[spring-boot-3.0.0-RC1.jar:3.0.0-RC1]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302)
~[spring-boot-3.0.0-RC1.jar:3.0.0-RC1]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1291)
~[spring-boot-3.0.0-RC1.jar:3.0.0-RC1]
at com.example.demo.DemoApplicationKt.main(DemoApplication.kt:13) ~[main/:na]
Caused by: java.lang.ClassCastException: class
sun.reflect.generics.reflectiveObjects.WildcardTypeImpl cannot be cast to class
java.lang.reflect.ParameterizedType
(sun.reflect.generics.reflectiveObjects.WildcardTypeImpl and
java.lang.reflect.ParameterizedType are in module java.base of loader
'bootstrap')
at
org.hibernate.type.descriptor.java.spi.RegistryHelper.determineJavaTypeClass(RegistryHelper.java:114)
~[hibernate-core-6.1.4.Final.jar:6.1.4.Final]
at
org.hibernate.type.descriptor.java.spi.RegistryHelper.createTypeDescriptor(RegistryHelper.java:90)
~[hibernate-core-6.1.4.Final.jar:6.1.4.Final]
at
org.hibernate.type.descriptor.java.spi.RegistryHelper.createTypeDescriptor(RegistryHelper.java:43)
~[hibernate-core-6.1.4.Final.jar:6.1.4.Final]
at
org.hibernate.type.descriptor.java.spi.JavaTypeRegistry.lambda$resolveDescriptor$1(JavaTypeRegistry.java:154)
~[hibernate-core-6.1.4.Final.jar:6.1.4.Final]
at
org.hibernate.type.descriptor.java.spi.JavaTypeRegistry.resolveDescriptor(JavaTypeRegistry.java:127)
~[hibernate-core-6.1.4.Final.jar:6.1.4.Final]
at
org.hibernate.type.descriptor.java.spi.JavaTypeRegistry.resolveDescriptor(JavaTypeRegistry.java:133)
~[hibernate-core-6.1.4.Final.jar:6.1.4.Final]
at
org.hibernate.type.descriptor.java.spi.CollectionJavaType.createJavaType(CollectionJavaType.java:66)
~[hibernate-core-6.1.4.Final.jar:6.1.4.Final]
at
org.hibernate.type.descriptor.java.spi.JavaTypeRegistry.lambda$resolveDescriptor$1(JavaTypeRegistry.java:140)
~[hibernate-core-6.1.4.Final.jar:6.1.4.Final]
at
org.hibernate.type.descriptor.java.spi.JavaTypeRegistry.resolveDescriptor(JavaTypeRegistry.java:127)
~[hibernate-core-6.1.4.Final.jar:6.1.4.Final]
at
org.hibernate.type.descriptor.java.spi.JavaTypeRegistry.resolveDescriptor(JavaTypeRegistry.java:133)
~[hibernate-core-6.1.4.Final.jar:6.1.4.Final]
at
org.hibernate.type.descriptor.java.spi.JavaTypeRegistry.getDescriptor(JavaTypeRegistry.java:73)
~[hibernate-core-6.1.4.Final.jar:6.1.4.Final]
at org.hibernate.mapping.BasicValue.buildResolution(BasicValue.java:400)
~[hibernate-core-6.1.4.Final.jar:6.1.4.Final]
at org.hibernate.mapping.BasicValue.resolve(BasicValue.java:315)
~[hibernate-core-6.1.4.Final.jar:6.1.4.Final]
at org.hibernate.mapping.BasicValue.resolve(BasicValue.java:305)
~[hibernate-core-6.1.4.Final.jar:6.1.4.Final]
at
org.hibernate.boot.internal.InFlightMetadataCollectorImpl.lambda$processValueResolvers$4(InFlightMetadataCollectorImpl.java:1766)
~[hibernate-core-6.1.4.Final.jar:6.1.4.Final]
at java.base/java.util.ArrayList.removeIf(ArrayList.java:1682) ~[na:na]
at java.base/java.util.ArrayList.removeIf(ArrayList.java:1660) ~[na:na]
at
org.hibernate.boot.internal.InFlightMetadataCollectorImpl.processValueResolvers(InFlightMetadataCollectorImpl.java:1765)
~[hibernate-core-6.1.4.Final.jar:6.1.4.Final]
at
org.hibernate.boot.internal.InFlightMetadataCollectorImpl.processSecondPasses(InFlightMetadataCollectorImpl.java:1751)
~[hibernate-core-6.1.4.Final.jar:6.1.4.Final]
at
org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:300)
~[hibernate-core-6.1.4.Final.jar:6.1.4.Final]
at
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1350)
~[hibernate-core-6.1.4.Final.jar:6.1.4.Final]
at
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1421)
~[hibernate-core-6.1.4.Final.jar:6.1.4.Final]
at
org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:66)
~[spring-orm-6.0.0-RC2.jar:6.0.0-RC2]
at
org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:376)
~[spring-orm-6.0.0-RC2.jar:6.0.0-RC2]
at
org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409)
~[spring-orm-6.0.0-RC2.jar:6.0.0-RC2]
at
org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396)
~[spring-orm-6.0.0-RC2.jar:6.0.0-RC2]
at
org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:352)
~[spring-orm-6.0.0-RC2.jar:6.0.0-RC2]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1799)
~[spring-beans-6.0.0-RC2.jar:6.0.0-RC2]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1749)
~[spring-beans-6.0.0-RC2.jar:6.0.0-RC2]
... 15 common frames omitted
I firstly raised this issue to Spring Boot
https://github.com/spring-projects/spring-boot/issues/32675 (
https://github.com/spring-projects/spring-boot/issues/32675 )
I attached very simple application that you can check.
It replicate exactly same error that I encountered from my pilot project.
If you comment below from EntityWithAttributeConverter.kt
@Column
@Convert(converter = BalanceUsageTypeListToStringConverter::class)
var usageType: Set<BalanceUsageType>,
it starts up fine, but if above is not commented, then above error will pop up.
(
https://hibernate.atlassian.net/browse/HHH-15624#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-15624#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#100209- sha1:9aa9d1d )