java - Use boolean value in HQL -


i have product class attribute :

boolean latest;  public boolean islatest() {     return latest; }  public void setlatest(boolean latest) {     this.latest = latest; } 

in database attribute bit type true/false value.

i want select products have latest = true. hql is:

from product latest = true

i tried:

from product p p.islatest true

from product latest true

but it's return products or failed. there way select products have latest attribute = true. great.

when ran this, using jdbc on apache derby database. trying set value of boolean field , trying "=true", "=1", etc. in end, used named parameter shown below , that's how got situation work.

session.createquery("select product latest = :latest").setboolean("latest", boolean.true); 

hopefully helps similar situation.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -