I have a product class with attribute like this :
Boolean latest;
public boolean isLatest() {
return latest;
}
public void setLatest(boolean latest) {
this.latest = latest;
}
In database the attribute is bit type with true/false value.
I want to select products which have latest = true. My hql is:
FROM Product WHERE latest = true
I also tried:
FROM Product p WHERE p.isLatest is true
FROM Product WHERE latest is true
But it's always return all products or failed. Is there any way to select the products which have latest attribute = true. Any help would be great.
getLatest()instead ofisLatest()to your entity?is trueand= trueboth work, withisLatest()), so it's got to be something small enough to be easily overlooked. Try changing the type fromBooleantoboolean, since your getter and setter are using primitive boolean type.isis for boolean.