Thursday, December 10, 2015

Hibernate + How to add condition in annotation ?

There are two ways to add the condition/where clause into the annotation class
1) at the class level
2) at the field method or field declaration

@Entity
@Table(name = "TBLM_PACKAGE")
@Where(clause = "PACKAGE_MODE!='DESIGN'")
public class PkgData{

       private String packageMode;


      @Column(name = "PACKAGE_MODE")
public String getPackageMode() {
return packageMode;
}

public void setPackageMode(String packageMode) {
this.packageMode = packageMode;
}

}


No comments:

Post a Comment