How do I query Hibernate for object where property may be null or specific value?
===

I have the following objects I'm working with:

RawRead
RawRead.Checkpoint

Checkpoint.EndCustomer

Guard


Where Checkpoint and Guard are properties of RawRead, EndCustomer is a property of Checkpoint. All are objects.

---

My current Hibernate gubbins:

	Criteria crit = sess.createCriteria(RawRead.class);
	crit.add(
	  Restrictions.or(
	    Restrictions.eq("checkpoint", null),
	    Restrictions.in("checkpoint.parentEndCustomer",collectionOfEndCustomers)
	  )
	);
	
So Checkpoint can be null, but if it is there I only want the RawRead objects where the parentEndCustomer object is in the checkpoint.parentEndCustomer property.

I hope that makes sense.

---

My guesstimate above produces an error that (to me) suggests that my criteria are incorrectly specified:

    [Request processing failed; nested exception is org.hibernate.QueryException: could not resolve property: checkpoint.parentEndCustomer of: uk.co.romar.guardian.objects.RawRead] with root cause org.hibernate.QueryException: 
    could not resolve property: checkpoint.parentEndCustomer of: uk.co.romar.guardian.objects.RawRead at 
    org.hibernate.persister.entity.AbstractPropertyMapping.propertyException(AbstractPropertyMapping.java:81) at 
    org.hibernate.persister.entity.AbstractPropertyMapping.toColumns(AbstractPropertyMapping.java:96)	at  
    org.hibernate.persister.entity.BasicEntityPropertyMapping.toColumns(BasicEntityPropertyMapping.java:62) at 
    org.hibernate.persister.entity.AbstractEntityPersister.toColumns(AbstractEntityPersister.java:1457)	at 
    org.hibernate.loader.criteria.CriteriaQueryTranslator.getColumns(CriteriaQueryTranslator.java:483)


Relevant bits of RawRead:

    @ManyToOne
    @JoinColumn(name="CHECKPOINT_OID")
    @NotFound(action=NotFoundAction.IGNORE)
    public Checkpoint checkpoint = null;
    public void setCheckpoint(Checkpoint in) {this.checkpoint = in;}
    public Checkpoint getCheckpoint() {return this.checkpoint;}

    @ManyToOne
    @JoinColumn(name="GUARD_OID")
    @NotFound(action=NotFoundAction.IGNORE)
    private Guard guard = null;
    public void setGuard(Guard in) {this.guard = in;}
    public Guard getGuard() {return this.guard;}

And from Checkpoint:

    	@ManyToOne
	@JoinColumn(name="ENDCUSTOMER_OID")
	@NotFound(action=NotFoundAction.IGNORE)
	private EndCustomer parentEndCustomer = null;
	public EndCustomer getParentEndCustomer() {return this.parentEndCustomer;}
	public void setParentEndCustomer(EndCustomer ownerCustomer) {this.parentEndCustomer = ownerCustomer;}
