0 Replies Latest reply on Jan 6, 2011 12:13 AM by Andriyana Tresnawan

    How to make a row with NULL column appears in EntityList?

    Andriyana Tresnawan Newbie
      I can't make the table compose with several null column (but not all column are NULL) to be appear in datatable List (the one that build by seam gen).
      For example I've got a table composed by column : ATASNAMA, EMAIL, BANK. And the BANK is allowed to have NULL. But I tried to put them in Datatable, the the entire record just don't appeared. But there is no error sign.
      HOw to make a table composed with BANK's NULL column appear in datatable?


      This is my bayarhome

      import com.aka.ppmbaka.model.*;
      import java.util.Date;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.framework.EntityHome;

      @Name("bayarHome")
      public class BayarHome extends EntityHome<Bayar> {
              public static final long serialVersionUID = 596009789001L;
              public void setBayarId(BayarId id) {
                      setId(id);
              }

              public BayarId getBayarId() {
                      return (BayarId) getId();
              }

              public BayarHome() {
                      setBayarId(new BayarId());
              }

              @Override
              public boolean isIdDefined() {
                      if (getBayarId().getAtasnamas() == null
                                      || "".equals(getBayarId().getAtasnamas()))
                              return false;
                      if (getBayarId().getEmail() == null
                                      || "".equals(getBayarId().getEmail()))
                              return false;
                      if (getBayarId().getNamabanks() == null
                                      || "".equals(getBayarId().getNamabanks()))
                              return false;
                      if (getBayarId().getNamabayar() == null
                                      || "".equals(getBayarId().getNamabayar()))
                              return false;
                      if (getBayarId().getNoreks() == null
                                      || "".equals(getBayarId().getNoreks()))
                              return false;
                      if (getBayarId().getTglbayars() == null)
                       return true;
                      if (getBayarId().getYt() == null)
                              return true;
                      return true;
              }

              @Override
              protected Bayar createInstance() {
                      Bayar bayar = new Bayar();             
                      bayar.setId(new BayarId());
                      return bayar;
              }

              public void load() {
                      if (isIdDefined()) {
                              wire();
                      }
              }

              public void wire() {
                      getInstance();
              }

              public boolean isWired() {
                      return true;
              }

              public Bayar getDefinedInstance() {
                      return isIdDefined() ? getInstance() : null;
              }

      }

      and this is my bayarList

      package com.aka.ppmbaka.action;

      import com.aka.ppmbaka.model.*;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.framework.EntityQuery;
      import java.util.Arrays;

      @Name("bayarList")
      public class BayarList extends EntityQuery<Bayar> {
              public static final long serialVersionUID = 596009789001L;
              private static final String EJBQL = "select bayar from Bayar bayar";
                     
              private static final String[] RESTRICTIONS = {
                              "lower(bayar.id.atasnamas) like lower(concat(#{bayarList.bayar.id.atasnamas},'%'))",
                              "lower(bayar.id.email) like lower(concat(#{bayarList.bayar.id.email},'%'))",
                              "lower(bayar.id.namabanks) like lower(concat(#{bayarList.bayar.id.namabanks},'%'))",
                              "lower(bayar.id.namabayar) like lower(concat(#{bayarList.bayar.id.namabayar},'%'))",
                              "lower(bayar.id.noreks) like lower(concat(#{bayarList.bayar.id.noreks},'%'))",
                              "lower(bayar.id.yt) like lower(concat(#{bayarList.bayar.id.yt},'%'))",};

              private Bayar bayar;

              public BayarList() {
                      bayar = new Bayar();
                      bayar.setId(new BayarId());
                      setEjbql(EJBQL);
                      setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS));
                      setMaxResults(25);
              }

              public Bayar getBayar() {
                      return bayar;
              }
      }


      Now I want all the data to be appeared in tablelist (using datamodel perhaps) even when there is NULL in BANK column?

      I appreciated for your help

      ANDRI
      Indonesia**||