How to perform a Non-Polymorphic JPQL query with JPA 1.0?
imagine i have 3 Entities, Basic
<- Sub
<- SubSub
. I want to select Basic
and Sub
but not SubSub
I have already discovered that in JPA 2.0 I can have this query
SELECT b FROM Basic b WHERE TYPE(b) IN (Basic,Sub)
But the implementation I have to work with is apache-openjpa-1.2.3-SNAPSHOT.
How can I accomplish the task with JPA 1.0? I'm open for anything. Can I query for the Discriminator Column (plain SQL or JPQL)? Is there some kind of queryHint? Can it be solved by not using Inheritance but some so开发者_运维问答rt of Composition?
I'd appreciate your help. thx
I didn't test, but I think that you need something similar to this:
SELECT b FROM Basic b WHERE b NOT IN (FROM SubSub)
精彩评论