-
- Notifications
You must be signed in to change notification settings - Fork 71
Description
Hi,
First of all, thanks for your great job on that library. It's very useful.
I encountered one unexpected behavior when trying to use the =isnull= operator on a manyToOne association.
I want to find all users with a NULL specialite.
Here are my JPA entities
// UserEntity @Entity @Table(name = "domain_user") public class UserEntity { {...} @ManyToOne @JoinColumn(name = "specialite_id") private SpecialiteEntity specialite; } // SpecialiteEntity @Entity @Table(name = "domain_specialite") public class SpecialiteEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") Long id {...} } My RSQL query looks like that
specialite.id=isnull=
I get no result at all.
I checked the generated SQL request, and there is something wrong
select * from domain_user user0_ inner join domain_specialite specialite1_ on user0_.specialite_id=specialite1_.id where specialite1_.id is null
Because of the where clause on the joined entity, of course there is no specialite with null id in the specialite table
In that particular case, i don't even need any join, the following request would be perfect
select * from domain_user user0_ where user0_.specialite_id is null
To avoid the join, I also tried to not use the 'id' property in the RSQL query
specialite=isnull=
But I got a NullPointerException when you try to resolve the attribute name from the ManyToOne association.
Do you have any workaround to do that ? Maybe i'm doing something wrong with the usage of your library, I hope you could help me :)
Thank you very much,
Cheers,
Cyril