1 Reply Latest reply on Jan 20, 2010 6:48 PM by yachaa

    show a row of table in EntityList.java

    neni ferawati Newbie
      Hi, guys!
      I want to know how to show a result of table AlumniList.java by ID_ALUMNI and this result of table can be opened by admin and owner ID_ALUMNI. I have read in manning of Seam in chapter 10 about smarter queries but I still understand.
      I think, it can work in query, but I don't know in where to modify in AlumniList.java or component.xml?
      This is the code of AlumniList.java :
      package org.alumni.action;

      import org.alumni.model.*;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.framework.EntityQuery;
      import java.util.Arrays;

      @Name("alumniList")
      public class AlumniList extends EntityQuery<Alumni> {

           private static final String EJBQL = "select alumni from Alumni alumni";

           private static final String[] RESTRICTIONS = {
                     "lower(alumni.alamatKantor) like concat(lower(#{alumniList.alumni.alamatKantor}),'%')",
                     "lower(alumni.alamatKontak) like concat(lower(#{alumniList.alumni.alamatKontak}),'%')",
                     "lower(alumni.asalSmu) like concat(lower(#{alumniList.alumni.asalSmu}),'%')",
                     "lower(alumni.email) like concat(lower(#{alumniList.alumni.email}),'%')",
                     "lower(alumni.jenisKelamin) like concat(lower(#{alumniList.alumni.jenisKelamin}),'%')",
                     "lower(alumni.kabupaten) like concat(lower(#{alumniList.alumni.kabupaten}),'%')",
                     "lower(alumni.kabupatenSmu) like concat(lower(#{alumniList.alumni.kabupatenSmu}),'%')",
                     "lower(alumni.kecamatan) like concat(lower(#{alumniList.alumni.kecamatan}),'%')",
                     "lower(alumni.kelurahan) like concat(lower(#{alumniList.alumni.kelurahan}),'%')",
                     "lower(alumni.kodePos) like concat(lower(#{alumniList.alumni.kodePos}),'%')",
                     "lower(alumni.namaLengkap) like concat(lower(#{alumniList.alumni.namaLengkap}),'%')",
                     "lower(alumni.nim) like concat(lower(#{alumniList.alumni.nim}),'%')",
                     "lower(alumni.noHp) like concat(lower(#{alumniList.alumni.noHp}),'%')",
                     "lower(alumni.noTelp) like concat(lower(#{alumniList.alumni.noTelp}),'%')",
                     "lower(alumni.noTelpKantor) like concat(lower(#{alumniList.alumni.noTelpKantor}),'%')",
                     "lower(alumni.prodi) like concat(lower(#{alumniList.alumni.prodi}),'%')",
                     "lower(alumni.propinsi) like concat(lower(#{alumniList.alumni.propinsi}),'%')",
                     "lower(alumni.propinsiSmu) like concat(lower(#{alumniList.alumni.propinsiSmu}),'%')",
                     "lower(alumni.status) like concat(lower(#{alumniList.alumni.status}),'%')",
                     "lower(alumni.tempatLahir) like concat(lower(#{alumniList.alumni.tempatLahir}),'%')",};

           private Alumni alumni = new Alumni();

           public AlumniList() {
                setEjbql(EJBQL);
                setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS));
                setMaxResults(25);
           }
           public Alumni getAlumni() {
                return alumni;
           }
      }

      Can I change EJBQL with this statement "select alumni from Alumni alumni order by alumni.ID_ALUMNI desc or user.ID_USER desc";