mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-17 16:44:57 +00:00
HHH-14724 Add test for intersection types
This commit is contained in:
parent
ffd22681cd
commit
1411e7bad3
@ -76,14 +76,21 @@ public void testListTypeWithImport() throws ClassNotFoundException, NoSuchFieldE
|
|||||||
@TestForIssue(jiraKey = "HHH-12338")
|
@TestForIssue(jiraKey = "HHH-12338")
|
||||||
@WithClasses({PhoneBook.class})
|
@WithClasses({PhoneBook.class})
|
||||||
public void testMapType() throws ClassNotFoundException, NoSuchFieldException {
|
public void testMapType() throws ClassNotFoundException, NoSuchFieldException {
|
||||||
assertMetamodelClassGeneratedFor(PhoneBook.class);
|
assertMetamodelClassGeneratedFor( PhoneBook.class );
|
||||||
|
|
||||||
assertAttributeTypeInMetaModelFor(
|
assertAttributeTypeInMetaModelFor(
|
||||||
PhoneBook.class,
|
PhoneBook.class,
|
||||||
"phones",
|
"phones",
|
||||||
PhoneBook.class.getDeclaredField("phones").getGenericType(),
|
PhoneBook.class.getDeclaredField( "phones" ).getGenericType(),
|
||||||
"Wrong meta model type"
|
"Wrong meta model type"
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestForIssue(jiraKey = "HHH-14724")
|
||||||
|
@WithClasses({ Like.class, ConcreteLike.class })
|
||||||
|
public void testIntersectionType() {
|
||||||
|
assertMetamodelClassGeneratedFor( ConcreteLike.class );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
package org.hibernate.jpamodelgen.test.collectionbasictype;
|
||||||
|
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
|
||||||
|
@Entity(name = "ConcreteLike")
|
||||||
|
public class ConcreteLike extends Like<ConcreteLike.Target> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Reference<Target> getObject() {
|
||||||
|
return new Reference<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Target implements Like.I1, Like.I2 {
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
package org.hibernate.jpamodelgen.test.collectionbasictype;
|
||||||
|
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Inheritance;
|
||||||
|
import javax.persistence.InheritanceType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Thomas Heigl
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
|
||||||
|
public abstract class Like<T extends Like.I1 & Like.I2> {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
public abstract Reference<T> getObject();
|
||||||
|
|
||||||
|
interface I1 {
|
||||||
|
}
|
||||||
|
|
||||||
|
interface I2 {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Reference<T> {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user