If you have this type of a JPA entity setup with a super class and a few child classes (see below), how do you write a JPA Query that would select say first 3 (ordered by created date) of each child class? Writing two separate queries and asking for specific subclass works fine, but I'd like to get it down to one query if possible.
@MappedSuperclass
public class Parent {
@Temporal(TIMESTAMP)
@Column(name = "created")
private Date created;
...
}
@Entity
@DiscriminatorValue("A")
public class ChildA extends Parent {
...
}
@Entity
@DiscriminatorValue("B")
public class ChildB extends Parent {
...
}