0 Replies Latest reply on Nov 19, 2007 4:27 AM by Roger Martin

    Tranforming a db 1 record row into a vertical table jsf disp

    Roger Martin Newbie

      Hi,

      In switching to seam(and POJO's) and keeping with the spirit of seam now being the handy glue from ejb's to jsf based pages, what would be the way to take a query that always produces one record row and then display to the user in columns in a jsf table or data grid? One record field now per jsf row? It is a common thing I do in my old self-deprecated glue and I'm wanting to replace it with seam.

      Each field of the Entity now is a row in the display; often put the queries' column title in the first column, second column is the field's value and a third is the units of the value.

      @Entity
      @Name("element")
      @Table(name = "ELEMENT")
      @NamedQueries({@NamedQuery(name = "Element.findByElementPk", query = "SELECT e FROM Element e WHERE e.elementPk = :elementPk"), @NamedQuery(name = "Element.findByName", query = "SELECT e FROM Element e WHERE e.name = :name"), @NamedQuery(name = "Element.findByAtomicNumber", query = "SELECT e FROM Element e WHERE e.atomicNumber = :atomicNumber"), @NamedQuery(name = "Element.findByAtomicSymbol", query = "SELECT e FROM Element e WHERE e.atomicSymbol = :atomicSymbol"), @NamedQuery(name = "Element.findByAtomicWeight", query = "SELECT e FROM Element e WHERE e.atomicWeight = :atomicWeight"), @NamedQuery(name = "Element.findByAtomicRadius", query = "SELECT e FROM Element e WHERE e.atomicRadius = :atomicRadius"), @NamedQuery(name = "Element.findByMeltingPoint", query = "SELECT e FROM Element e WHERE e.meltingPoint = :meltingPoint"), @NamedQuery(name = "Element.findByBoilingPoint", query = "SELECT e FROM Element e WHERE e.boilingPoint = :boilingPoint"), @NamedQuery(name = "Element.findByOxidationStates", query = "SELECT e FROM Element e WHERE e.oxidationStates = :oxidationStates"), @NamedQuery(name = "Element.findByElectronConfiguration", query = "SELECT e FROM Element e WHERE e.electronConfiguration = :electronConfiguration")})
      public class Element implements Serializable {
       private static final long serialVersionUID = 1L;
       @Id
       @Column(name = "ELEMENT_PK", nullable = false)
       private Integer elementPk;
       @Column(name = "NAME")
       private String name;
       @Column(name = "ATOMIC_NUMBER")
       private Short atomicNumber;
       @Column(name = "ATOMIC_SYMBOL")
       private String atomicSymbol;
       @Column(name = "ATOMIC_WEIGHT")
       private Double atomicWeight;
       @Column(name = "ATOMIC_RADIUS")
       private Double atomicRadius;
       @Column(name = "MELTING_POINT")
       private Double meltingPoint;
       @Column(name = "BOILING_POINT")
       private Double boilingPoint;
       @Column(name = "OXIDATION_STATES")
       private Short oxidationStates;
       @Column(name = "ELECTRON_CONFIGURATION")
       private String electronConfiguration;
      


      So the jsf table is now three columns labeled:
      Parameter Value Units
      Name Hydrogen
      Atomic Number: 1
      Atomic Radius 78 pm
      Atomic Symbol H
      Melting Point - 259.34 �C
      Atomic Weight 1.0079 g/mol
      Boiling Point -252.87 �C
      Electron Configuration 1s1
      Oxidation States 1, -1