How do I query for only superclass entities in a jpql query?

Viewed 12859

I have the following entities:

@Entity
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name="orderType", discriminatorType=DiscriminatorType.STRING)
@DiscriminatorValue(value="BASE")
@Table(name = "orders")
public class OrderEntity implements Serializable {
...

and

@Entity
@DiscriminatorValue(value="RECURRING")
public class RecurringOrderEntity extends OrderEntity{
...

I can find all the subclasses (RecurringOrderEntity) with the following jpql:

Query q = em.createQuery(
                "SELECT o from RecurringOrderEntity o where "
                + "o.cancellationDate is null "
                + "and o.maxOccurrences = o.occurrence");

What is the JPQL syntax for finding only entities that are not instances of RecurringOrderEntity?

I am using Eclipselink 2.0.0 as the JPA provider.

thanks!

1 Answers
Related