So I’m writting a JPAContainer filter for an entity that has a @ManyToOne relationship with a second entity.
The following query works nicely (mostly):
Contact is on the Many side (an is the primary entity) and SectionType is on the one side.
return new Or(new Or(new SimpleStringFilter(Contact_.firstname.getName(), filterString, true, false),
new SimpleStringFilter(Contact_.lastname.getName(), filterString, true, false)),
new SimpleStringFilter(Contact_.section.getName() + "." + SectionType_.name.getName(), filterString, true, false));
The problem is that a Contact doesn’t actually need to have a SectionType but the above filter generates an inner join to the SectionType. The result is that any Contacts that don’t have a SectionType are never returned when the above filter is applied.
It would appear to me that a simple change to the predicte generation to change the join to a left outer join would fix the problem.
I should note that whilst the documentation suggests that a SimpleStringFilter is an in memory search examination of the code clearly shows it generating a JPA criteria.
Am i doing something wrong or should I submit a feature request?
Brett