Here are my beans :

The entity bean (just the attributes) :

  | @Entity
  | @Table(name = "collectivites", schema = "public")
  | public class Collectivites implements java.io.Serializable {
  | 
  |     private int colidt;
  |     private Typcol typcol;
  |     private Departements departements;
  |     private String colnom;
  |     private String coltel;
  |     private String colfax;
  |     private String coladr;
  |     private String colcp;
  |     private String colnmc;
  |     private String coltlc;
  |     private Integer colpop;
  |     private String colaff;
  |     private String colvil;
  | 
  |     public Collectivites() {
  |     }
  | 
  |  + getter and setter
  |     ...
  | 

The query bean : 

  | @Name("collectivitesList")
  | public class CollectivitesList extends EntityQuery {
  | 
  |             
  |     private static final String[] RESTRICTIONS = {
  |                     "lower(collectivites.colnom) like 
concat('%',lower(#{collectivitesList.collectivites.colnom}),'%')",
  |                     "lower(collectivites.coltel) like 
concat(lower(#{collectivitesList.collectivites.coltel}),'%')",
  |                     "lower(collectivites.colfax) like 
concat(lower(#{collectivitesList.collectivites.colfax}),'%')",
  |                     "lower(collectivites.coladr) like 
concat(lower(#{collectivitesList.collectivites.coladr}),'%')",
  |                     "lower(collectivites.colcp) like 
concat(lower(#{collectivitesList.collectivites.colcp}),'%')",
  |                     "lower(collectivites.colnmc) like 
concat(lower(#{collectivitesList.collectivites.colnmc}),'%')",
  |                     "lower(collectivites.coltlc) like 
concat(lower(#{collectivitesList.collectivites.coltlc}),'%')",
  |                     "lower(collectivites.colvil) like 
concat('%',lower(#{collectivitesList.collectivites.colvil}),'%')",
  |                     "collectivites.colaff like 
concat(#{collectivitesList.collectivites.colaff},'%')",
  |                     "collectivites.typcol like 
concat(#{collectivitesList.collectivites.typcol},'%')",};
  | 
  |     private Collectivites collectivites = new Collectivites();
  | 
  |     @Override
  |     public String getEjbql() {
  |             return "select collectivites from Collectivites collectivites";
  |     }
  | 
  |     @Override
  |     public Integer getMaxResults() {
  |             return 25;
  |     }
  | 
  |     public Collectivites getCollectivites() {
  |             return collectivites;
  |     }
  | 
  |     @Override
  |     public List<String> getRestrictions() {
  |             return Arrays.asList(RESTRICTIONS);
  |     }
  | 
  | }

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4056372#4056372

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4056372
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to