1 Reply Latest reply on Jun 6, 2006 9:34 AM by Dave Whittaker

    Outject EJB

    Gerd Michalke Newbie


      I am working on a risk managing app based on the DVD store demo in order to evaluate seam for further developments. In the searchAction.java, I have the following construct:

      @EJB @Out(scope=ScopeType.SESSION,required=false)
      AccesTicketTypeLocal accesTicketType;

      Here is its code of the bean.

      public class AccesTicketTypeBean implements AccesTicketTypeLocal, Serializable {

      /** Creates a new instance of AccesTypeTickeBean */
      public AccesTicketTypeBean() {

      private List ticketType;
      Map<String,TicketType> ticketTypesMap;

      EntityManager em;

      public void loadData(TypeFormulaire tf) {
      System.out.println("============appel de loadData ticketType avec tf="+tf.getReference());
      ticketType = em.createQuery("from TicketType c where c.typeFormulaire=:tf")
      .setHint("org.hibernate.cacheable", true)

      Map<String,TicketType> results = new TreeMap<String,TicketType>();

      for (TicketType tt: ticketType) {
      System.out.println("======== TicketType="+tt.getId()+","+tt.getDescription());
      ticketTypesMap = results;

      public Converter getConverter() {
      return new TicketTypeConverter(ticketType);

      public Map<String, TicketType> getTicketTypes() {

      System.out.println("=======appel getTicketTypes");
      Collection tt = ticketTypesMap.keySet();
      for (String t:tt)

      return ticketTypesMap;

      public TicketType getNullTicketType() {
      return new TicketType();

      static public class TicketTypeConverter
      implements Converter,
      List tfs;

      public TicketTypeConverter(List tf) {
      this.tfs = tf;

      public String getAsString(FacesContext facesContext,
      UIComponent component,
      Object obj)
      if (obj == null) return null;

      String val = String.valueOf( ((TicketType)obj).getId());
      return val;

      public Object getAsObject(FacesContext facesContext,
      UIComponent component,
      String str)
      throws ConverterException
      if (str == null || str.length()==0) {
      return null;

      String id = str;
      for (TicketType tf : tfs) {
      //System.out.println("on teste "+tf.getReference());
      if (tf.getId().equals(id)) {
      //System.out.println("on trouve "+tf.getDescription());
      return tf;

      return null;


      Then I inject it via seam in a jsf page:

      <h:selectOneMenu value="#{search.ticketType}"
      <f:selectItems value="#{accesTicketType.ticketTypes}" />

      <h:commandButton action="#{search.attribueTicket}"
      class="formButton" style="width: 166px;"/>

      This works great when it shows the data in the HTML list; but when I click on the button, the value search.ticketType remains at value null.

      Some help available ?

      Kind regards,