Vojtěch Knyttl ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... ) *created* an issue
Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiNDdjOWI0MTkw... ) / Bug ( https://hibernate.atlassian.net/browse/HHH-16562?atlOrigin=eyJpIjoiNDdjOW... ) HHH-16562 ( https://hibernate.atlassian.net/browse/HHH-16562?atlOrigin=eyJpIjoiNDdjOW... ) the return value of "org.hibernate.annotations.common.reflection.XProperty.getMapKey()" is null ( https://hibernate.atlassian.net/browse/HHH-16562?atlOrigin=eyJpIjoiNDdjOW... )
Issue Type: Bug Affects Versions: 6.2.2 Assignee: Unassigned Created: 05/May/2023 22:34 PM Environment: Hi,
we are trying to upgrade from 5.x version of Hibernate to 6.x and we are stuck on an error, which is problematic to create as a MRE.
The issue seems to be cause by @OrderColumn annotation:
```
@OrderColumn
@ManyToMany(fetch = FetchType.LAZY, cascade = [CascadeType.MERGE])
@JoinTable(inverseJoinColumns = [JoinColumn(name = "video_id")])
var videos: MutableList<Video> = ArrayList()
```
When trying to create PersistenceManager, the creation fails with:
```
Caused by: java.lang.NullPointerException: Cannot invoke "org.hibernate.annotations.common.reflection.XClass.getName()" because the return value of "org.hibernate.annotations.common.reflection.XProperty.getMapKey()" is null
at org.hibernate.boot.model.internal.ClassPropertyHolder$1.doSecondPass(ClassPropertyHolder.java:312)
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.processSecondPasses(InFlightMetadataCollectorImpl.java:1846)
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.processSecondPasses(InFlightMetadataCollectorImpl.java:1803)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:328)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1380)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1451)
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:66)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:376)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:352)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1816)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1766)
... 86 more
```
However once the `@OrderColumn` is removed, everything seems to work correctly.
We tried to create a MRE, but everything keeps working correctly. There must be something specific in our codebase which creates this.
I know it is hard to reproduce the issue based on a stacktrace, but maybe you would have more insight than me to this? Priority: Major Reporter: Vojtěch Knyttl ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... )
( https://hibernate.atlassian.net/browse/HHH-16562#add-comment?atlOrigin=ey... ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-16562#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=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100225- sha1:7f918b6 )