HHH-15285 Add test for issue

This commit is contained in:
Andrea Boriero 2022-05-19 16:40:12 +02:00 committed by Andrea Boriero
parent 2af19a6278
commit 192b591c51
2 changed files with 68 additions and 0 deletions

View File

@ -0,0 +1,39 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.orm.test.metamodel;
import java.util.List;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.orm.junit.EntityManagerFactoryScope;
import org.hibernate.testing.orm.junit.Jpa;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat;
@Jpa(
annotatedClasses = {
TestEntity.class,
Person.class
}
)
@TestForIssue(jiraKey = "HHH-15285")
public class MetamodelJavaTypeTest {
@Test
public void testJavaType(EntityManagerFactoryScope scope) {
scope.inEntityManager(
entityManager -> {
assertThat( TestEntity_.people.getJavaType() ).isEqualTo( List.class );
assertThat( TestEntity_.addresses.getJavaType() ).isEqualTo( List.class );
assertThat( TestEntity_.elementCollection.getJavaType() ).isEqualTo( List.class );
}
);
}
}

View File

@ -0,0 +1,29 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.orm.test.metamodel;
import java.util.List;
import jakarta.persistence.ElementCollection;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.OneToMany;
@Entity
public class TestEntity {
@Id
private int id;
@OneToMany
private List<Person> people;
@ElementCollection
private List<Address> addresses;
@ElementCollection
private List<String> elementCollection;
}