Any particular reason why metamodel.entity(Entity.class). getSingularAttribute("key1").getMember()
returns Entity.EntityId#key1
rather than Entity#key1
if Entity.EntityId
is the @IdClass
of Entity
? And equivalently getJavaType()
returns i.e. Long
rather than the hyptothetical SomeAssociationType
? Is this a bug?
@Entity @IdClass(Entity.EntityId.class) public class Entity {
@Id private Long key2;
@Id @ManyToOne private SomeAssociationType key1;
public static class EntityId implements Serializable {
private Long key1, key2;
}
}
@Entity public class SomeAssociationType {
@Id private Long id;
}
// This is the problem
assertEquals(
metamodel.entity(Entity.class). getSingularAttribute("key1").getJavaType(), // Long
metamodel.entity(Entity.class). getSingularAttribute("key1").getType().getJavaType() // SomeAssociationType