|
I'm able to reproduce this in 4.3.6 with out using ManyToOne or any other relationship tags. This code doesn't complain if I change the nestedEmbeddable field to be @Transient, so it seems to be what's causing the problem. Also, if I make the other basic fields in EmbeddedWithNestedEmbedded @Transient, I notice that the value in the associated ArrayIndexOutOfBoundsException is decremented once for each field I make @Transient, ending at zero if there are no other fields except nestedEmbeddable.
public class Main {
public static void main(String[] args) {
Persistence.createEntityManagerFactory("test");
}
@Entity
public class TestEntity {
@Id int id;
@Embedded EmbeddedWithElementCollection embedded;
}
@Embeddable
public class EmbeddedWithElementCollection {
@ElementCollection
List<EmbeddedWithNestedEmbedded> embeddedsWithEmbedded;
}
@Embeddable
public class EmbeddedWithNestedEmbedded {
String field1;
int field2;
@Embedded
SimpleEmbedded nestedEmbedded;
}
@Embeddable
public class SimpleEmbedded {
String fieldA;
int fieldB;
}
}
Here's my persistence.xml ...
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http:
xmlns:xsi="http:
xsi:schemaLocation="http:http: <persistence-unit name="test">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect" />
</properties>
</persistence-unit>
</persistence>
|