mirror of
https://github.com/querydsl/querydsl.git
synced 2026-06-13 21:01:01 +08:00
Improve null handling
This commit is contained in:
parent
5cdb0e3112
commit
a6d14a2602
@ -107,7 +107,7 @@ public final class Configuration {
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public String asLiteral(Object o) {
|
||||
if (Null.class.isInstance(o)) {
|
||||
if (o == null || o instanceof Null) {
|
||||
return "null";
|
||||
} else {
|
||||
Type type = javaTypeMapping.getType(o.getClass());
|
||||
@ -222,7 +222,7 @@ public final class Configuration {
|
||||
*/
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public <T> void set(PreparedStatement stmt, Path<?> path, int i, T value) throws SQLException {
|
||||
if (Null.class.isInstance(value)) {
|
||||
if (value == null || value instanceof Null) {
|
||||
Integer sqlType = null;
|
||||
if (path != null) {
|
||||
ColumnMetadata columnMetadata = ColumnMetadata.getColumnMetadata(path);
|
||||
|
||||
@ -895,6 +895,12 @@ public class SelectBase extends AbstractBaseTest {
|
||||
assertEquals(0, query().from(employee).where(employee.id.in(ImmutableList.<Integer>of())).fetchCount());
|
||||
}
|
||||
|
||||
@Test
|
||||
@ExcludeIn(DERBY)
|
||||
public void in_null() {
|
||||
assertEquals(1, query().from(employee).where(employee.id.in(1, null)).fetchCount());
|
||||
}
|
||||
|
||||
@Test
|
||||
@ExcludeIn({MYSQL, TERADATA})
|
||||
public void in_subqueries() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user