1 Reply Latest reply on Jul 19, 2012 10:14 AM by Pavol Pitonak

    rich:pickList Converter.getAsObject -> problems with Injection

    Martin Book Newbie



      i have following Picklist:


      <rich:pickList id="acc1" value="#{passwdDetail.uFuncSelected}" ...
      <f:selectItems value="#{passwdDetail.items.kUserFunktionItems}" ...
      <f:converter converterId="RoleConverter" />    


      I have tried to use @Inject or @EJB to inject Persistence class. Both cause Nullpointer-Exception.

      public class RoleConverter implements Converter{
       EntityManager em;
       private PasswdProducer passwdProducer;
       public Object getAsObject(FacesContext arg0, UIComponent arg1, String arg2) {
        //List <KUserFunktion> kuser=em.createQuery( "from KUserFunktion").getResultList(); 
        List <KUserFunktion> kuser=passwdProducer.findAll(KUserFunktion.class);
        for (KUserFunktion userFunk : kuser ) {
         if (String.valueOf(String.valueOf(userFunk.getId())).equals(arg2)) {
          return userFunk;
        return null;