here is my delema...
Code:
@Entity
class A{
@Id
long id;
...
}
@Entity
class Wrapper{
@Id
long id;
@OneToOne
@JoinColumns({@JoinColumn(name="a_id",referencedColumnName="id")})
A a;
...
}
what I want in sql looks like this...
Code:
select a.*
from A a
join outer Wrapper w
on a.id = w.a_id
where w.a_id is null
Thus giving me all As that are not in B. I have successfully created it with an Exists query, but the outer join performs better. I want to create a criteria query that creates this query, but I can't seem to figure out how to define the reverse relationship, since the FK is defined on wrapper.
If I start with:
Code:
DetachedCriteria dc = DetachedCriteria.forClass(A.class, "a");
how do I then explain the relationship to Wrapper. If I start with the wrapper class, then it is a right outer join and Criteria does not support it.
Is jql my only option?