Skip to content

Commit

Permalink
HHH-16261 - Test case for HHH-16261
Browse files Browse the repository at this point in the history
  • Loading branch information
cigaly authored and beikov committed Apr 25, 2023
1 parent c73f4e2 commit 52e84fb
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 0 deletions.
@@ -0,0 +1,7 @@
package org.hibernate.jpamodelgen.test.records;

import jakarta.persistence.Embeddable;

@Embeddable
public record Address(String street, String city, String postalCode) {
}
@@ -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;
}
}
@@ -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);
}
}

0 comments on commit 52e84fb

Please sign in to comment.