mysema/querydsl — Issue #25: request for change "IllegalArgumentException: eq(null) is not allowed. Use isNull() instead"
Author: AndreTheHunter
Created: 2011-10-10 00:46:46+00:00
State: open

When using com.mysema.query.types.expr.SimpleExpression.eq(Expression right) where right is set to null an IllegalArgumentException is thrown:

java.lang.IllegalArgumentException: eq(null) is not allowed. Use isNull() instead

This is by design (see https://bugs.launchpad.net/querydsl/+bug/720078) however it would be better to check if right is null and use isNull() accordingly. e.g.

```java
public BooleanExpression eq(T right) {
return right == null ? isNull() : eq(new ConstantImpl(right));
}
```
see SimpleExpression.java:124

At the moment I have to do this null checking in my code every time I want to use .eq(...). This is cumbersome which defeats the purpose of Querydsl's fluent design.