1 Reply Latest reply on Sep 10, 2007 5:28 PM by Kim Lord

    Seam CRUD: Search results columns blank only Select, need he

    Kim Lord Newbie

      I have a website created using seam generate-entities and am having a problem with blank search results when all the columns in the associated database table do not contain data. The search results list only displays the Select link. If all table fields contain data then the proper display is rendered. Not all the table fields are required so blanks are acceptable. The following is the code I am using:
      SubHndbkTextView.java

      package com.sonalysts.acintinterface;
      // Generated Aug 30, 2007 1:25:53 PM by Hibernate Tools 3.2.0.b9
      
      import javax.persistence.AttributeOverride;
      import javax.persistence.AttributeOverrides;
      import javax.persistence.Column;
      import javax.persistence.EmbeddedId;
      import javax.persistence.Entity;
      import javax.persistence.Table;
      import org.hibernate.validator.NotNull;
      
      /**
       * SubHndbkTextView generated by hbm2java
       */
      @Entity
      @Table(name = "SUB_HNDBK_TEXT_VIEW")
      public class SubHndbkTextView implements java.io.Serializable {
      
       private SubHndbkTextViewId id;
      
       public SubHndbkTextView() {
       }
      
       public SubHndbkTextView(SubHndbkTextViewId id) {
       this.id = id;
       }
      
       @EmbeddedId
       @AttributeOverrides({
       @AttributeOverride(name = "platformId", column = @Column(name = "PLATFORM_ID", nullable = false, precision = 38, scale = 0)),
       @AttributeOverride(name = "typeText", column = @Column(name = "TYPE_TEXT", length = 25)),
       @AttributeOverride(name = "textRmks", column = @Column(name = "TEXT_RMKS", length = 2000)),
       @AttributeOverride(name = "metadataId", column = @Column(name = "METADATA_ID", nullable = false, precision = 38, scale = 0))})
       @NotNull
       public SubHndbkTextViewId getId() {
       return this.id;
       }
      
       public void setId(SubHndbkTextViewId id) {
       this.id = id;
       }
      
      }
      


      SubHndbkTextViewHome.java:
      package com.sonalysts.acintinterface;
      
      import java.math.BigDecimal;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.framework.EntityHome;
      
      @Name("subHndbkTextViewHome")
      public class SubHndbkTextViewHome extends EntityHome<SubHndbkTextView> {
      
       public void setSubHndbkTextViewId(SubHndbkTextViewId id) {
       setId(id);
       }
      
       public SubHndbkTextViewId getSubHndbkTextViewId() {
       return (SubHndbkTextViewId) getId();
       }
      
       public SubHndbkTextViewHome() {
       setSubHndbkTextViewId(new SubHndbkTextViewId());
       }
      
       @Override
       public boolean isIdDefined() {
       if (getSubHndbkTextViewId().getPlatformId() == null)
       return false;
       if (getSubHndbkTextViewId().getTypeText() == null)
       return false;
       if (getSubHndbkTextViewId().getTextRmks() == null)
       return false;
       if (getSubHndbkTextViewId().getMetadataId() == null)
       return false;
       return true;
       }
      
       @Override
       protected SubHndbkTextView createInstance() {
       SubHndbkTextView subHndbkTextView = new SubHndbkTextView();
       subHndbkTextView.setId(new SubHndbkTextViewId());
       return subHndbkTextView;
       }
      
       public void wire() {
       }
      
       public boolean isWired() {
       return true;
       }
      
       public SubHndbkTextView getDefinedInstance() {
       return isIdDefined() ? getInstance() : null;
       }
      
      }
      


      SubHndbkTextViewId.java:
      package com.sonalysts.acintinterface;
      // Generated Aug 30, 2007 1:25:53 PM by Hibernate Tools 3.2.0.b9
      
      import java.math.BigDecimal;
      import javax.persistence.Column;
      import javax.persistence.Embeddable;
      import org.hibernate.validator.Length;
      import org.hibernate.validator.NotNull;
      
      /**
       * SubHndbkTextViewId generated by hbm2java
       */
      @Embeddable
      public class SubHndbkTextViewId implements java.io.Serializable {
      
       private BigDecimal platformId;
       private String typeText;
       private String textRmks;
       private BigDecimal metadataId;
      
       public SubHndbkTextViewId() {
       }
      
       public SubHndbkTextViewId(BigDecimal platformId, BigDecimal metadataId) {
       this.platformId = platformId;
       this.metadataId = metadataId;
       }
       public SubHndbkTextViewId(BigDecimal platformId, String typeText,
       String textRmks, BigDecimal metadataId) {
       this.platformId = platformId;
       this.typeText = typeText;
       this.textRmks = textRmks;
       this.metadataId = metadataId;
       }
      
       @Column(name = "PLATFORM_ID", nullable = false, precision = 38, scale = 0)
       @NotNull
       public BigDecimal getPlatformId() {
       return this.platformId;
       }
      
       public void setPlatformId(BigDecimal platformId) {
       this.platformId = platformId;
       }
      
       @Column(name = "TYPE_TEXT", length = 25)
       @Length(max = 25)
       public String getTypeText() {
       return this.typeText;
       }
      
       public void setTypeText(String typeText) {
       this.typeText = typeText;
       }
      
       @Column(name = "TEXT_RMKS", length = 2000)
       @Length(max = 2000)
       public String getTextRmks() {
       return this.textRmks;
       }
      
       public void setTextRmks(String textRmks) {
       this.textRmks = textRmks;
       }
      
       @Column(name = "METADATA_ID", nullable = false, precision = 38, scale = 0)
       @NotNull
       public BigDecimal getMetadataId() {
       return this.metadataId;
       }
      
       public void setMetadataId(BigDecimal metadataId) {
       this.metadataId = metadataId;
       }
      
       public boolean equals(Object other) {
       if ((this == other))
       return true;
       if ((other == null))
       return false;
       if (!(other instanceof SubHndbkTextViewId))
       return false;
       SubHndbkTextViewId castOther = (SubHndbkTextViewId) other;
      
       return ((this.getPlatformId() == castOther.getPlatformId()) || (this
       .getPlatformId() != null
       && castOther.getPlatformId() != null && this.getPlatformId()
       .equals(castOther.getPlatformId())))
       && ((this.getTypeText() == castOther.getTypeText()) || (this
       .getTypeText() != null
       && castOther.getTypeText() != null && this
       .getTypeText().equals(castOther.getTypeText())))
       && ((this.getTextRmks() == castOther.getTextRmks()) || (this
       .getTextRmks() != null
       && castOther.getTextRmks() != null && this
       .getTextRmks().equals(castOther.getTextRmks())))
       && ((this.getMetadataId() == castOther.getMetadataId()) || (this
       .getMetadataId() != null
       && castOther.getMetadataId() != null && this
       .getMetadataId().equals(castOther.getMetadataId())));
       }
      
       public int hashCode() {
       int result = 17;
      
       result = 37
       * result
       + (getPlatformId() == null ? 0 : this.getPlatformId()
       .hashCode());
       result = 37 * result
       + (getTypeText() == null ? 0 : this.getTypeText().hashCode());
       result = 37 * result
       + (getTextRmks() == null ? 0 : this.getTextRmks().hashCode());
       result = 37
       * result
       + (getMetadataId() == null ? 0 : this.getMetadataId()
       .hashCode());
       return result;
       }
      
      }


      SubHndbkTextViewList.java:
      package com.sonalysts.acintinterface;
      
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.framework.EntityQuery;
      import java.util.List;
      import java.util.Arrays;
      
      @Name("subHndbkTextViewList")
      public class SubHndbkTextViewList extends EntityQuery {
      
       private static final String[] RESTRICTIONS = {
       "lower(subHndbkTextView.id.typeText) like concat(lower(#{subHndbkTextViewList.subHndbkTextView.id.typeText}),'%')",
       "lower(subHndbkTextView.id.textRmks) like concat(lower(#{subHndbkTextViewList.subHndbkTextView.id.textRmks}),'%')",};
      
       private SubHndbkTextView subHndbkTextView;
      
       public SubHndbkTextViewList() {
       subHndbkTextView = new SubHndbkTextView();
       subHndbkTextView.setId(new SubHndbkTextViewId());
       }
      
       @Override
       public String getEjbql() {
       return "select subHndbkTextView from SubHndbkTextView subHndbkTextView";
       }
      
       @Override
       public Integer getMaxResults() {
       return 25;
       }
      
       public SubHndbkTextView getSubHndbkTextView() {
       return subHndbkTextView;
       }
      
       @Override
       public List<String> getRestrictions() {
       return Arrays.asList(RESTRICTIONS);
       }
      
      }
      


      Thanks for your help,
      Kim