I want to know why it didn't work either. I am using latest version of
TomEE (1.5 SNAPSHOT), Myfaces 2.1.9, and CODI. Didn't work almost 12 hours
ago, when I was attempting to use it.

Did you all test @Advanced with @FacesConverter(forClass=someClass.class)?

That's how I was using it, and bean was not injected inside of the
converter. I read in at least 2 places that stated that @FacesConverter is
not an elligble injection point, and I think you already told me (within
last few hours) that this will be available in JSF 2.2. :)



On Tue, Nov 20, 2012 at 9:22 AM, Mark Struberg <strub...@yahoo.de> wrote:

> CDI injection using @Advanced should work perfectly fine. We tested this
> excessively and use it on several containers in production.
>
> I'm curious why it doesn't work for you.
>
> LieGrue,
> strub
>
>
> ----- Original Message -----
> > From: "Howard W. Smith, Jr." <smithh032...@gmail.com>
> > To: MyFaces Discussion <users@myfaces.apache.org>; Rafael Pestano <
> rmpest...@yahoo.com.br>
> > Cc:
> > Sent: Tuesday, November 20, 2012 3:13 PM
> > Subject: Re: Migrating to CDI: injecting stateless/facade in Converter
> via facescontext
> >
> > Rafael,
> >
> > I saw that page about CODI @Advanced. :)
> >
> > I tried CODI @Advanced, but CDI managed bean was not injected voa
> @Inject,
> > and then I tried to inject Stateless EJB via @Inject, and that stateless
> > EJB was not injected either.
> >
> > Thanks,
> > Howard
> >
> > On Tue, Nov 20, 2012 at 9:02 AM, Rafael Pestano
> > <rmpest...@yahoo.com.br>wrote:
> >
> >>  you can also use CODI @Advanced and then inject "anything" in the
> >>  converter, see [1].
> >>
> >>  i hope it helps.
> >>
> >>  [1]:
> >>
> https://cwiki.apache.org/EXTCDI/jsf-usage.html#JSFUsage-DependencyInjection
> >>
> >>
> >>  Att,
> >>
> >>  Rafael M. Pestano
> >>
> >>  Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
> >>  Graduando em Ciência da Computação UFRGS
> >>  http://conventionsframework.org
> >>
> >>  http://rpestano.wordpress.com/
> >>  @realpestano
> >>
> >>
> >>  ________________________________
> >>   De: "Howard W. Smith, Jr." <smithh032...@gmail.com>
> >>  Para: Mark Struberg <strub...@yahoo.de>; MyFaces Discussion <
> >>  users@myfaces.apache.org>
> >>  Cc: "us...@openejb.apache.org" <us...@openejb.apache.org>
> >>  Enviadas: Terça-feira, 20 de Novembro de 2012 11:37
> >>  Assunto: Re: Migrating to CDI: injecting stateless/facade in Converter
> via
> >>  facescontext
> >>
> >>  Interesting and noted, thanks. Yes, I did hear JSF 2.2 will allow CDI
> in
> >>  facesconverter. Thanks.
> >>  On Nov 20, 2012 8:34 AM, "Mark Struberg"
> > <strub...@yahoo.de> wrote:
> >>
> >>  > you could also have used CODI BeanManagerProvider#getReference to get
> >>  > access to the bean.
> >>  >
> >>  > The support you need out of the box will come in JSF-2.2.
> >>  >
> >>  >
> >>  > LieGrue,
> >>  > strub
> >>  >
> >>  >
> >>  >
> >>  > ----- Original Message -----
> >>  > > From: "Howard W. Smith, Jr."
> > <smithh032...@gmail.com>
> >>  > > To: us...@openejb.apache.org; MyFaces Discussion <
> >>  > users@myfaces.apache.org>
> >>  > > Cc:
> >>  > > Sent: Tuesday, November 20, 2012 1:56 PM
> >>  > > Subject: Re: Migrating to CDI: injecting stateless/facade in
> > Converter
> >>  > via facescontext
> >>  > >
> >>  > >T he goal was to inject bean in facesconverter via CDI, but I
> > don't have
> >>  > > this need anymore, since faces converter is not an eligible
> > injection
> >>  > > point, so I opted to use request scoped JSF managed beans that
> > have
> >>  > > facesconverter defined within the bean. That's working fine.
> > Thanks.
> >>  > >
> >>  > > Okay, I can cc myfaces user group as well, going forward. :-)
> >>  > > On Nov 20, 2012 7:37 AM, "Romain Manni-Bucau"
> >>  > > <rmannibu...@gmail.com>
> >>  > > wrote:
> >>  > >
> >>  > >>  i'm still not clear about your goal and where you need
> > injection
> >>  > >>
> >>  > >>  maybe share a (runnable) sample to show us what you are
> > talking about
> >>  > >>
> >>  > >>  side note: myfaces list can help you a lot about it too
> >>  > >>
> >>  > >>  *Romain Manni-Bucau*
> >>  > >>  *Twitter: @rmannibucau
> > <https://twitter.com/rmannibucau>*
> >>  > >>  *Blog: **http://rmannibucau.wordpress.com/*<
> >>  > >>  http://rmannibucau.wordpress.com/>
> >>  > >>  *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> >>  > >>  *Github: https://github.com/rmannibucau*
> >>  > >>
> >>  > >>
> >>  > >>
> >>  > >>
> >>  > >>  2012/11/20 Howard W. Smith, Jr.
> > <smithh032...@gmail.com>
> >>  > >>
> >>  > >>  > Interesting, that will allow you to get instance of
> > beans, if
> >>  already
> >>  > >>  > instantiated, and that could have helped in converter,
> > only if
> >>  beans
> >>  > >>  > already injected earlier?
> >>  > >>  > On Nov 20, 2012 7:11 AM, "Romain Manni-Bucau"
> >>  > > <rmannibu...@gmail.com>
> >>  > >>  > wrote:
> >>  > >>  >
> >>  > >>  > > was thinking to
> >>  > >>  > >
> >>  > >>  >
> >>  > >>
> >>  >
> >>
> http://docs.oracle.com/javaee/6/api/javax/faces/context/FacesContext.html
> >>  > >>  > > getAttributes()
> >>  > >>  > > method (depend a bit on your real need)
> >>  > >>  > >
> >>  > >>  > > *Romain Manni-Bucau*
> >>  > >>  > > *Twitter: @rmannibucau
> > <https://twitter.com/rmannibucau>*
> >>  > >>  > > *Blog: **http://rmannibucau.wordpress.com/*<
> >>  > >>  > > http://rmannibucau.wordpress.com/>
> >>  > >>  > > *LinkedIn:
> > **http://fr.linkedin.com/in/rmannibucau*
> >>  > >>  > > *Github: https://github.com/rmannibucau*
> >>  > >>  > >
> >>  > >>  > >
> >>  > >>  > >
> >>  > >>  > >
> >>  > >>  > > 2012/11/20 Howard W. Smith, Jr.
> > <smithh032...@gmail.com>
> >>  > >>  > >
> >>  > >>  > > > Faces context? Please explain.
> >>  > >>  > > >  On Nov 20, 2012 1:56 AM, "Romain
> > Manni-Bucau"
> >>  > > <
> >>  > >>  rmannibu...@gmail.com>
> >>  > >>  > > > wrote:
> >>  > >>  > > >
> >>  > >>  > > > > You cant use faces context?
> >>  > >>  > > > > Le 20 nov. 2012 03:01, "Howard W.
> > Smith, Jr."
> >>  > > <
> >>  > >>  > smithh032...@gmail.com>
> >>  > >>  > > a
> >>  > >>  > > > > écrit :
> >>  > >>  > > > >
> >>  > >>  > > > > > For minimal changes, I'm adding
> > FacesConverter
> >>  > > to JSF
> >>  > >>  requestscoped
> >>  > >>  > > > > > managedBean's as per the
> > Stackoverflow answer
> >>  > > below:
> >>  > >>  > > > > >
> >>  > >>  > > > > > How can I inject in
> > @FacesConverter?<
> >>  > >>  > > > > >
> > http://stackoverflow.com/a/13156834/933054>
> >>  > >>  > > > > >
> >>  > >>  > > > > > Yes, this means more classes in the
> > project, but
> >>  > > honestly, I have
> >>  > >>  > not
> >>  > >>  > > > had
> >>  > >>  > > > > > to spend much time
> > 'maintaining' my
> >>  > > Converter classes at all. I
> >>  > >>  > just
> >>  > >>  > > > > tested
> >>  > >>  > > > > > this concept, and I'm not
> > experiencing this
> >>  > > exceptioin any more.
> >>  > >>  > > > > >
> >>  > >>  > > > > > While testing the above, I see more
> > exceptions to
> >>  > > resolve related
> >>  > >>  > to
> >>  > >>  > > > > > migrating to CDI. Will let you all
> > know, if I have
> >>  > > any more
> >>  > >>  > > questions.
> >>  > >>  > > > > >
> >>  > >>  > > > > > Thanks for all the responses/help,
> > so far. :)
> >>  > >>  > > > > >
> >>  > >>  > > > > >
> >>  > >>  > > > > >
> >>  > >>  > > > > > On Mon, Nov 19, 2012 at 7:20 PM,
> > Romain
> >>  > > Manni-Bucau
> >>  > >>  > > > > > <rmannibu...@gmail.com>wrote:
> >>  > >>  > > > > >
> >>  > >>  > > > > > > If it is a nested class you
> > need it otherwise
> >>  > > (class foo in
> >>  > >>  > > foo.java
> >>  > >>  > > > > > file)
> >>  > >>  > > > > > > you dont need it
> >>  > >>  > > > > > > Le 20 nov. 2012 01:16,
> > "Howard W. Smith,
> >>  > > Jr." <
> >>  > >>  > > > smithh032...@gmail.com>
> >>  > >>  > > > > a
> >>  > >>  > > > > > > écrit :
> >>  > >>  > > > > > >
> >>  > >>  > > > > > > > Good question. I removed
> >>  > > 'static', because I didn't see it in
> >>  > >>  > the
> >>  > >>  > > > > code
> >>  > >>  > > > > > at
> >>  > >>  > > > > > > > following URLs:
> >>  > >>  > > > > > > >
> >>  > >>  > > > > > > >
> >>  > >>  > > > > > > >
> >>  > >>  > > > > > >
> >>  > >>  > > > > >
> >>  > >>  > > > >
> >>  > >>  > > >
> >>  > >>  > >
> >>  > >>  >
> >>  > >>
> >>  > >
> >>  >
> >>
> >
> https://cwiki.apache.org/confluence/display/EXTCDI/JSF+Usage#JSFUsage-DependencyInjection
> >>  > >>  > > > > > > >
> >>  > >>  > > > > > > >
> >>  > >>  > > > > > > >
> >>  > >>  > > > > > >
> >>  > >>  > > > > >
> >>  > >>  > > > >
> >>  > >>  > > >
> >>  > >>  > >
> >>  > >>  >
> >>  > >>
> >>  > >
> >>  >
> >>
> >
> http://stackoverflow.com/questions/7531449/cdi-injection-into-a-facesconverter
> >>  > >>  > > > > > > >
> >>  > >>  > > > > > > >
> >>  > > https://issues.apache.org/jira/browse/EXTCDI-127
> >>  > >>  > > > > > > >
> >>  > >>  > > > > > > >
> >>  > >>  > > > > > > > On Mon, Nov 19, 2012 at
> > 4:30 PM, Romain
> >>  > > Manni-Bucau
> >>  > >>  > > > > > > >
> > <rmannibu...@gmail.com>wrote:
> >>  > >>  > > > > > > >
> >>  > >>  > > > > > > > > Why removing static?
> > It means it is
> >>  > > no more manageable by
> >>  > >>  cdi
> >>  > >>  > > > (cdi
> >>  > >>  > > > > > cant
> >>  > >>  > > > > > > > do
> >>  > >>  > > > > > > > > a new on it)
> >>  > >>  > > > > > > > > Le 19 nov. 2012
> > 22:13, "Howard
> >>  > > W. Smith, Jr." <
> >>  > >>  > > > > > smithh032...@gmail.com>
> >>  > >>  > > > > > > a
> >>  > >>  > > > > > > > > écrit :
> >>  > >>  > > > > > > > >
> >>  > >>  > > > > > > > > > @Advanced was
> > found in the
> >>  > > following:
> >>  > >>  > > > > > > > > >
> >>  > >>  > > > > > > > > > import
> >>  > >>  org.apache.myfaces.extensions.cdi.core.api.Advanced;
> >>  > >>  > > > > > > > > >
> >>  > >>  > > > > > > > > > After some
> > tinkering, I
> >>  > > removed 'static' from the
> >>  > >>  following
> >>  > >>  > > > > > > definition,
> >>  > >>  > > > > > > > > >
> >>  > >>  > > > > > > > > > public static
> > class
> >>  > > AddressTypeControllerConverter
> >>  > >>  > implements
> >>  > >>  > > > > > > > Converter {
> >>  > >>  > > > > > > > > >
> >>  > >>  > > > > > > > > > I also added
> > @Advanced to the
> >>  > > FacesConverter/Converter,
> >>  > >>  and
> >>  > >>  > > > > latest
> >>  > >>  > > > > > > > error
> >>  > >>  > > > > > > > > is
> >>  > >>  > > > > > > > > > the following:
> >>  > >>  > > > > > > > > >
> >>  > >>  > > > > > > > > > Nov 19, 2012
> > 4:08:21 PM
> >>  > >>  > > > > >
> > javax.faces.component._ExternalSpecifications
> >>  > >>  > > > > > > > > >
> > isBeanValidationAvailable
> >>  > >>  > > > > > > > > > INFO: MyFaces
> > Bean Validation
> >>  > > support enabled
> >>  > >>  > > > > > > > > > Nov 19, 2012
> > 4:08:21 PM
> >>  > >>  > > > > > >
> >>  > > org.apache.myfaces.application.ApplicationImpl
> >>  > >>  > > > > > > > > >
> > internalCreateConverter
> >>  > >>  > > > > > > > > > SEVERE: Could
> > not instantiate
> >>  > > converter class
> >>  > >>  > > > > > > > > >
> >>  > >>  > > > >
> >>  > >
> > jsf.address.pf_AddressTypeController$AddressTypeControllerConverter
> >>  > >>  > > > > > > > > >
> >>  > > java.lang.InstantiationException:
> >>  > >>  > > > > > > > > >
> >>  > >>  > > > >
> >>  > >
> > jsf.address.pf_AddressTypeController$AddressTypeControllerConverter
> >>  > >>  > > > > > > > > >
> >>  > >>  > > > > > > > > >
> >>  > >>  > > > > > > > > >
> >>  > >>  > > > > > > > > > On Mon, Nov 19,
> > 2012 at 3:07
> >>  > > PM, Howard W. Smith, Jr. <
> >>  > >>  > > > > > > > > >
> > smithh032...@gmail.com>
> >>  > > wrote:
> >>  > >>  > > > > > > > > >
> >>  > >>  > > > > > > > > > > I searched
> > google, found
> >>  > > the following:
> >>  > >>  > > > > > > > > > >
> >>  > >>  > > > > > > > > > > CDI
> > Injection into a
> >>  > > FacesConverter<
> >>  > >>  > > > > > > > > >
> >>  > >>  > > > > > > > >
> >>  > >>  > > > > > > >
> >>  > >>  > > > > > >
> >>  > >>  > > > > >
> >>  > >>  > > > >
> >>  > >>  > > >
> >>  > >>  > >
> >>  > >>  >
> >>  > >>
> >>  > >
> >>  >
> >>
> >
> http://stackoverflow.com/questions/7531449/cdi-injection-into-a-facesconverter
> >>  > >>  > > > > > > > > > >
> >>  > >>  > > > > > > > > > >
> >>  > >>  > > > > > > > > > > which lead
> > me to:
> >>  > >>  > > > > > > > > > >
> >>  > >>  > > > > > > > > > > MyFaces
> > Extensions CDI
> >>  > >>  JSF Usage > Dependency
> >>  > >>  > Injection<
> >>  > >>  > > > > > > > > >
> >>  > >>  > > > > > > > >
> >>  > >>  > > > > > > >
> >>  > >>  > > > > > >
> >>  > >>  > > > > >
> >>  > >>  > > > >
> >>  > >>  > > >
> >>  > >>  > >
> >>  > >>  >
> >>  > >>
> >>  > >
> >>  >
> >>
> >
> https://cwiki.apache.org/confluence/display/EXTCDI/JSF+Usage#JSFUsage-DependencyInjection
> >>  > >>  > > > > > > > > > >
> >>  > >>  > > > > > > > > > >
> >>  > >>  > > > > > > > > > > but I
> > don't which
> >>  > > library to import for @Advanced.
> >>  > >>  > > > > > > > > > >
> >>  > >>  > > > > > > > > > > If
> > @Advanced can be used
> >>  > > (since I am using CODI), then
> >>  > >>  > this
> >>  > >>  > > > > would
> >>  > >>  > > > > > > be
> >>  > >>  > > > > > > > > > great.
> >>  > >>  > > > > > > > > > >
> >>  > >>  > > > > > > > > > >
> >>  > >>  > > > > > > > > > > On Mon,
> > Nov 19, 2012 at
> >>  > > 2:56 PM, Romain Manni-Bucau <
> >>  > >>  > > > > > > > > >
> > rmannibu...@gmail.com
> >>  > >>  > > > > > > > > > > >
> > wrote:
> >>  > >>  > > > > > > > > > >
> >>  > >>  > > > > > > > > > >> Maybe
> > use
> >>  > > BeanProvider of deltaspike
> >>  > >>  > > > > > > > > > >> Le 19
> > nov. 2012
> >>  > > 20:50, "Howard W. Smith, Jr." <
> >>  > >>  > > > > > > > smithh032...@gmail.com
> >>  > >>  > > > > > > > > >
> >>  > >>  > > > > > > > > > a
> >>  > >>  > > > > > > > > > >> écrit
> > :
> >>  > >>  > > > > > > > > > >>
> >>  > >>  > > > > > > > > > >> >
> > Hmmm... after
> >>  > > thinking about it, I remembered to use
> >>  > >>  > > > @Inject
> >>  > >>  > > > > > on
> >>  > >>  > > > > > > > the
> >>  > >>  > > > > > > > > > bean
> >>  > >>  > > > > > > > > > >> >
> > which I want to
> >>  > > inject. So, I did the following:
> >>  > >>  > > > > > > > > > >> >
> >>  > >>  > > > > > > > > > >> >
> >>  > > @FacesConverter(forClass = AddressType.class)
> >>  > >>  > > > > > > > > > >> >
> >    public
> >>  > > static class
> >>  > >>  AddressTypeControllerConverter
> >>  > >>  > > > > > > implements
> >>  > >>  > > > > > > > > > >>
> > Converter
> >>  > >>  > > > > > > > > > >> > {
> >>  > >>  > > > > > > > > > >> >
> >>  > >>  > > > > > > > > > >> >
> >        @Inject
> >>  > >>  > > > > > > > > > >> >
> >        private
> >>  > > pf_AddressTypeController controller;
> >>  > >>  > > > > > > > > > >> >
> >>  > >>  > > > > > > > > > >> >
> >        public
> >>  > > Object getAsObject(FacesContext
> >>  > >>  > > > facesContext,
> >>  > >>  > > > > > > > > > UIComponent
> >>  > >>  > > > > > > > > > >> >
> > component,
> >>  > > String value) {
> >>  > >>  > > > > > > > > > >> >
> >            if
> >>  > > (value == null || value.length() ==
> >>  > >>  0)
> >>  > >>  > {
> >>  > >>  > > > > > > > > > >> >
> >>  > > return null;
> >>  > >>  > > > > > > > > > >> >
> >            }
> >>  > >>  > > > > > > > > > >> >
> >>  > > return
> >>  > >>  > > > controller.ejbFacade.find(getKey(value));
> >>  > >>  > > > > > > > > > >> >
> >        }
> >>  > >>  > > > > > > > > > >> >
> >>  > >>  > > > > > > > > > >> >
> > but
> >>  > > 'controller' is still not being injected. I even
> >>  > >>  > > tried
> >>  > >>  > > > > the
> >>  > >>  > > > > > > > same
> >>  > >>  > > > > > > > > > for
> >>  > >>  > > > > > > > > > >> the
> >>  > >>  > > > > > > > > > >> >
> > actual
> >>  > > 'ejbFacade' (which is a stateless bean), but
> >>  > >>  > > that,
> >>  > >>  > > > > too,
> >>  > >>  > > > > > > > > > resulted
> >>  > >>  > > > > > > > > > >> in
> >>  > >>  > > > > > > > > > >> > a
> >>  > > NullPointerException, which tells me that @Inject
> >>  > >>  is
> >>  > >>  > > not
> >>  > >>  > > > > > > > injecting
> >>  > >>  > > > > > > > > > >> >
> >>  > > pf_AddressTypeController (@sessionscoped bean) OR
> >>  > >>  > > > ejbFacade
> >>  > >>  > > > > > > > > > (@Stateless
> >>  > >>  > > > > > > > > > >> >
> > bean instance of
> >>  > > AddressTypeFacade).
> >>  > >>  > > > > > > > > > >> >
> >>  > >>  > > > > > > > > > >> >
> >>  > >>  > > > > > > > > > >> >
> > Is there a
> >>  > > general practice used for injecting beans
> >>  > >>  > in
> >>  > >>  > > > > > > > Converters..
> >>  > >>  > > > > > > > > > >> >
> >>  > >>  > > > > > > > > > >> >
> >>  > >>  > > > > > > > > > >> >
> >>  > >>  > > > > > > > > > >> >
> > On Mon, Nov 19,
> >>  > > 2012 at 2:38 PM, Romain Manni-Bucau
> >>  > >>  > > > > > > > > > >> >
> >>  > > <rmannibu...@gmail.com>wrote:
> >>  > >>  > > > > > > > > > >> >
> >>  > >>  > > > > > > > > > >> >
> >>  Can you
> >>  > > reproduce it in a sample? What is on the
> >>  > >>  npe
> >>  > >>  > > > line?
> >>  > >>  > > > > > > > > > >> >
> >>  Le 19 nov.
> >>  > > 2012 20:25, "Howard W. Smith, Jr." <
> >>  > >>  > > > > > > > > >
> > smithh032...@gmail.com>
> >>  > >>  > > > > > > > > > >> a
> >>  > >>  > > > > > > > > > >> >
> >>  écrit :
> >>  > >>  > > > > > > > > > >> >
> >>
> >>  > >>  > > > > > > > > > >> >
> >>  > I am
> >>  > > still migrating my app from JSF Managed
> >>  > >>  beans
> >>  > >>  > > to
> >>  > >>  > > > > CDI
> >>  > >>  > > > > > > > > managed
> >>  > >>  > > > > > > > > > >> >
> > beans,
> >>  > >>  > > > > > > > > > >> >
> >>  so
> >>  > >>  > > > > > > > > > >> >
> >>  > I am
> >>  > > (regression) testing, and I came across the
> >>  > >>  > > > > exception
> >>  > >>  > > > > > > > below
> >>  > >>  > > > > > > > > > >> when
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > > attempting to add a record into the database on
> >>  > >>  > one
> >>  > >>  > > of
> >>  > >>  > > > > the
> >>  > >>  > > > > > > > xhtml
> >>  > >>  > > > > > > > > > >> pages.
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > >>  > > > > > > > > > >> >
> >>  > Caused
> >>  > > by: java.lang.NullPointerException
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > > at
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > >>  > > > > > > > > > >> >
> >>
> >>  > >>  > > > > > > > > > >> >
> >>  > >>  > > > > > > > > > >>
> >>  > >>  > > > > > > > > >
> >>  > >>  > > > > > > > >
> >>  > >>  > > > > > > >
> >>  > >>  > > > > > >
> >>  > >>  > > > > >
> >>  > >>  > > > >
> >>  > >>  > > >
> >>  > >>  > >
> >>  > >>  >
> >>  > >>
> >>  > >
> >>  >
> >>
> >
> jsf.address.pf_AddressTypeController$AddressTypeControllerConverter.getAsObject(pf_AddressTypeController.java:283)
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > >>  > > > > > > > > > >> >
> >>  > The
> >>  > > exception is caused by this line below.
> >>  > >>  > > > *ejbFacade*
> >>  > >>  > > > > > is a
> >>  > >>  > > > > > > > > > >>
> > stateless
> >>  > >>  > > > > > > > > > >> >
> >>  bean
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > > injected by @Inject.
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > >      return
> >>  > >>  > > > > > >
> > controller.*ejbFacade*.find(getKey(value));
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > >>  > > > > > > > > > >> >
> >>  > The
> >>  > > code below is as-is using JSF Managed Beans.
> >>  > >>  > > > Please
> >>  > >>  > > > > > > advise
> >>  > >>  > > > > > > > > on
> >>  > >>  > > > > > > > > > >> how I
> >>  > >>  > > > > > > > > > >> >
> >>  > should
> >>  > > update the following code, so it will
> >>  > >>  work
> >>  > >>  > > well
> >>  > >>  > > > > > with
> >>  > >>  > > > > > > > CDI.
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > > @FacesConverter(forClass =
> >>  > >>  AddressType.class)
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > > public static class
> >>  > >>  > > AddressTypeControllerConverter
> >>  > >>  > > > > > > > > implements
> >>  > >>  > > > > > > > > > >> >
> >>  Converter
> >>  > >>  > > > > > > > > > >> >
> >>  > {
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > > public Object getAsObject(FacesContext
> >>  > >>  > > > > > facesContext,
> >>  > >>  > > > > > > > > > >> >
> > UIComponent
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > > component, String value) {
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > >      if (value == null || value.length()
> >>  > >>  ==
> >>  > >>  > > 0)
> >>  > >>  > > > {
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > >          return null;
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > >      }
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > >      pf_AddressTypeController controller
> >>  > >>  =
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > > (pf_AddressTypeController)
> >>  > >>  > > > > > > > > > >> >
> >>  > > facesContext.getApplication().getELResolver().
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > >>  > > > > getValue(facesContext.getELContext(),
> >>  > >>  > > > > > > > null,
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > > "pf_addressTypeController");
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > >      return
> >>  > >>  > > > > >
> > controller.ejbFacade.find(getKey(value));
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > > }
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > > java.lang.Integer getKey(String value) {
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > >      java.lang.Integer key;
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > >      key = Integer.valueOf(value);
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > >      return key;
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > > }
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > > String getStringKey(java.lang.Integer
> >>  > >>  > > value) {
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > >      StringBuffer sb = new
> >>  > >>  StringBuffer();
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > >      sb.append(value);
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > >      return sb.toString();
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > > }
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > > public String getAsString(FacesContext
> >>  > >>  > > > > > facesContext,
> >>  > >>  > > > > > > > > > >> >
> > UIComponent
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > > component, Object object) {
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > >      if (object == null) {
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > >          return null;
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > >      }
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > >      if (object instanceof AddressType) {
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > >          AddressType o = (AddressType)
> >>  > >>  > > object;
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > >          return
> >>  > >>  > > > > getStringKey(o.getAddressTypeId());
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > >      } else {
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > >          throw new
> >>  > >>  > > > > IllegalArgumentException("object
> >>  > >>  > > > > > > " +
> >>  > >>  > > > > > > > > > >> object
> >>  > >>  > > > > > > > > > >> > +
> > "
> >>  > >>  > > > > > > > > > >> >
> >>  > is of
> >>  > > type " + object.getClass().getName() + ";
> >>  > >>  > > > expected
> >>  > >>  > > > > > > type:
> >>  > >>  > > > > > > > > " +
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > > pf_AddressTypeController.class.getName());
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > >      }
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > > }
> >>  > >>  > > > > > > > > > >> >
> >>  >     }
> >>  > >>  > > > > > > > > > >> >
> >>  > }
> >>  > >>  > > > > > > > > > >> >
> >>  >
> >>  > >>  > > > > > > > > > >> >
> >>
> >>  > >>  > > > > > > > > > >> >
> >>  > >>  > > > > > > > > > >>
> >>  > >>  > > > > > > > > > >
> >>  > >>  > > > > > > > > > >
> >>  > >>  > > > > > > > > >
> >>  > >>  > > > > > > > >
> >>  > >>  > > > > > > >
> >>  > >>  > > > > > >
> >>  > >>  > > > > >
> >>  > >>  > > > >
> >>  > >>  > > >
> >>  > >>  > >
> >>  > >>  >
> >>  > >>
> >>  > >
> >>  >
> >>
> >
>

Reply via email to