David Stutzman (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=70121%3...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiMDRiNmE3OWM2...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-15630?atlOrigin=eyJpIjoiMDRiNm...
) HHH-15630 (
https://hibernate.atlassian.net/browse/HHH-15630?atlOrigin=eyJpIjoiMDRiNm...
) ElementCollection with nested Embeddable does not work (
https://hibernate.atlassian.net/browse/HHH-15630?atlOrigin=eyJpIjoiMDRiNm...
)
Issue Type: Bug Affects Versions: 5.6.12 Assignee: Unassigned Components: hibernate-core
Created: 26/Oct/2022 02:56 AM Environment: JDK 17, Quarkus 2.13.3 Priority: Minor
Reporter: David Stutzman (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=70121%3...
)
Information below should be the same as:
https://discourse.hibernate.org/t/elementcollection-with-nested-embeddabl... (
https://discourse.hibernate.org/t/elementcollection-with-nested-embeddabl... )
This class hierarchy fails:
@Entity
public class Foo implements Serializable {
@Id
@GeneratedValue
String id;
@ElementCollection
Set<Bar> bars;
}
@Embeddable
public class Bar {
@Embedded
Baz baz;
}
@Embeddable
class Baz {
String property;
}
I get the error:
2022-10-25 16:01:06,124 ERROR [io.qua.run.Application] (Quarkus Main Thread) Failed to
start application (with profile dev): java.lang.ArrayIndexOutOfBoundsException: Index 0
out of bounds for length 0
at
org.hibernate.persister.collection.AbstractCollectionPersister.generateSelectSizeString(AbstractCollectionPersister.java:1048)
at
org.hibernate.persister.collection.AbstractCollectionPersister.<init>(AbstractCollectionPersister.java:522)
at
org.hibernate.persister.collection.BasicCollectionPersister.<init>(BasicCollectionPersister.java:59)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at
java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
at
java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
at
org.hibernate.persister.internal.PersisterFactoryImpl.createCollectionPersister(PersisterFactoryImpl.java:152)
at
org.hibernate.persister.internal.PersisterFactoryImpl.createCollectionPersister(PersisterFactoryImpl.java:140)
at org.hibernate.metamodel.internal.MetamodelImpl.initialize(MetamodelImpl.java:226)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:319)
at
io.quarkus.hibernate.orm.runtime.boot.FastBootEntityManagerFactoryBuilder.build(FastBootEntityManagerFactoryBuilder.java:74)
at
io.quarkus.hibernate.orm.runtime.FastBootHibernatePersistenceProvider.createEntityManagerFactory(FastBootHibernatePersistenceProvider.java:72)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:80)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
at
io.quarkus.hibernate.orm.runtime.JPAConfig$LazyPersistenceUnit.get(JPAConfig.java:165)
at io.quarkus.hibernate.orm.runtime.JPAConfig$1.run(JPAConfig.java:66)
at java.base/java.lang.Thread.run(Thread.java:833)
I don’t know if it helps but earlier in the application log there’s this:
2022-10-25 16:01:05,544 DEBUG [org.hib.cfg.CollectionSecondPass] (Quarkus Main Thread)
Second pass for collection: com.example.Foo.bars
2022-10-25 16:01:05,544 DEBUG [org.hib.cfg.ann.CollectionBinder] (Quarkus Main Thread)
Binding a collection of element: com.example.Foo.bars
2022-10-25 16:01:05,547 DEBUG [org.hib.cfg.Ejb3Column] (Quarkus Main Thread) Binding
column: Ejb3Column{table=org.hibernate.mapping.Table(Foo_bars), mappingColumn=baz,
insertable=true, updatable=true, unique=false}
2022-10-25 16:01:05,547 DEBUG [org.hib.cfg.ann.PropertyBinder] (Quarkus Main Thread)
Building property baz
2022-10-25 16:01:05,548 DEBUG [org.hib.map.PrimaryKey] (Quarkus Main Thread) Forcing
column [foo_id] to be non-null as it is part of the primary key for table [foo_bars]
2022-10-25 16:01:05,548 DEBUG [org.hib.cfg.CollectionSecondPass] (Quarkus Main Thread)
Mapped collection key: Foo_id, element:
(
https://hibernate.atlassian.net/browse/HHH-15630#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-15630#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:6031644 )