Kuwe wrote:
So, I guess one cannot use an Example Query here?!
Code:
Group example = new Group();
example.setA("red");
example.setB("large");
example.setC(null);
List result = session.createCriteria(Group.class)
.add(Example.create(example)
.excludeNone() // Don't exclude zero or null properties
.exclude("d") // Exclude the property named d
.list();
It would be nice if there were a way to include() a single null property but it doesn't appear that there is. So you need to .excludeNone() and to turn off the null-exclusion and then exclude any additional properties you want to exclude from the example.