HHH-16261 - Test case for HHH-16261

This commit is contained in:
Cedomir Igaly 2023-04-01 14:02:09 +02:00 committed by Christian Beikov
parent 9be331cb97
commit de8b40ea79
3 changed files with 79 additions and 0 deletions

View File

@ -0,0 +1,7 @@
package org.hibernate.jpamodelgen.test.records;
import jakarta.persistence.Embeddable;
@Embeddable
public record Address(String street, String city, String postalCode) {
}

View File

@ -0,0 +1,53 @@
package org.hibernate.jpamodelgen.test.records;
import jakarta.persistence.Embedded;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
@Entity
public class Author {
@Id
@GeneratedValue
private Long id;
@Embedded
private Address address;
private String firstName;
private String lastName;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
}

View File

@ -0,0 +1,19 @@
package org.hibernate.jpamodelgen.test.records;
import org.hibernate.jpamodelgen.test.util.CompilationTest;
import org.hibernate.jpamodelgen.test.util.TestForIssue;
import org.hibernate.jpamodelgen.test.util.WithClasses;
import org.junit.Test;
import static org.hibernate.jpamodelgen.test.util.TestUtil.assertMetamodelClassGeneratedFor;
public class Java14RecordsTest extends CompilationTest {
@Test
@TestForIssue(jiraKey = "HHH-16261")
@WithClasses({Address.class, Author.class})
public void testEmbeddableRecordProperty() {
assertMetamodelClassGeneratedFor(Address.class);
assertMetamodelClassGeneratedFor(Author.class);
}
}