Andrea Boriero (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *commented* on HHH-15658 (
https://hibernate.atlassian.net/browse/HHH-15658?atlOrigin=eyJpIjoiMTEwNG...
)
Re: Embeddable with more fields than the parent fails with Index out of Bounds (
https://hibernate.atlassian.net/browse/HHH-15658?atlOrigin=eyJpIjoiMTEwNG...
)
Hi Phil Haeusler (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) ,
I have created this reproducer
@DomainModel(
annotatedClasses = EmbeddableTest.Person.class
)
@SessionFactory
public class EmbeddableTest {
@BeforeEach
public void setUp(SessionFactoryScope scope) {
scope.inTransaction(
session -> {
Address address = new Address( "Milan", "Italy",
"Italy", "20133" );
Person person = new Person( 1, address );
Address address2 = new Address( "Garbagnate", "Italy",
"Italy", "20024" );
Person person2 = new Person( 2, address2 );
session.persist( person );
session.persist( person2 );
}
);
}
@Test
public void testList(SessionFactoryScope scope) {
scope.inTransaction(
session -> {
List<Person> people = session.createQuery( "select p from Person p",
Person.class )
.list();
assertThat( people.size() ).isEqualTo( 2 );
}
);
}
@Entity(name = "Person")
public static class Person {
@Id
private Integer id;
private Address address;
public Person() {
}
public Person(Integer id, Address address) {
this.id = id;
this.address = address;
}
}
@Embeddable
public static class Address {
private String city;
private String state;
private String country;
private String postcode;
public Address() {
}
public Address(String city, String state, String country, String postcode) {
this.city = city;
this.state = state;
this.country = country;
this.postcode = postcode;
}
}
}
but the test passes, am I missing anything?
can you please provide a reproducer?
Thanks
(
https://hibernate.atlassian.net/browse/HHH-15658#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-15658#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#100210- sha1:4f8bc0d )