Hi
Hoping this is a basic question. Hibernate is executing this query (which I've converted to SQL to make it easier to read)
select a.*
from account a, person p
where (a.personID=p.personID)
and (a.username like 'ABC123')
and p.person_state<>'left'
and p.person_state<>'missing'
and p.person_state<>'absent'
and p.person_state<>'deleted'
order by p.RealName asc, p.forenames asc limit 10;
In my Account object, the relationship with Person is as follows
Code:
@OneToOne(fetch=FetchType.EAGER)
@JoinColumn(name="personID", nullable=true)
@NotFound(action=NotFoundAction.IGNORE)
private Person person;
Unfortunately, its a legacy database, and instead of having a null value for the personID when there isn't a matching Person record, it has -1. My join (and therefore my query) fails (there are no Person records with an id of -1)
Is there a way to modify the join to bring back results even when Account.personID = -1?
Thanks