To a lot of problems with @MappedSuperclass with generics.
We have: {code:java} @MappedSuperclass public class AbstractEntity<ID extends Serializable> { @Id @GeneratedValue protected ID id; ... } {code}
And we have:
{code:java} @Entity @Table(name = "SomeEntity") public class SomeEntity extends AbstractEntity<Integer> { } {code}
Next, jpa criteria: {code:java} public Predicate toPredicate(Root root, CriteriaQuery criteriaQuery, CriteriaBuilder criteriaBuilder) { {color:red}//Here we have - Serializable, but expected Integer.{color} root.get("id").getJavaType(); return ...; } {code}
If the generic parameter is just type, we have Object at getJavaType(). |
|