Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
...ing/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/records/Address.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.hibernate.jpamodelgen.test.records; | ||
|
||
import jakarta.persistence.Embeddable; | ||
|
||
@Embeddable | ||
public record Address(String street, String city, String postalCode) { | ||
} |
53 changes: 53 additions & 0 deletions
53
tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/records/Author.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...del-generator/src/test/java/org/hibernate/jpamodelgen/test/records/Java14RecordsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |