3 Replies Latest reply on Aug 31, 2007 4:13 AM by Branimir Minkov

    Multiple injection of the same type

    Branimir Minkov Newbie

      Hello

      I have been struggling for two days but still do not find the answer. Imagine the following scenario:

      --- EJB ----
      ...
      @Stateful
      @Scope(SESSION)
      @Name("testDataBindingManager")
      public class TestDataBindingAction implements TestDataBinding {

      @In(value="suppAddress", required=false) private TestAddress suppAddress;
      @In(value="buyAddress", required=false) private TestAddress buyAddress;
      ...

      --- EJB Entity ----
      @Entity
      @Name("address")
      public class TestAddress {
      ...
      --- EJB Entity ----

      --- A Part of Facelet ----

      <h:form id="supplierAddressForm">

      ID : <h:inputText value="#{suppAddress.id}" />
      City : <h:inputText value="#{suppAddress.cityName}" />
      TEST : <h:commandButton value="Add New Supplier Address" action="#{testDataBindingManager.addNewSupplierAddress}" />

      </h:form>

      <h:form id="buyerAddressForm">

      ID : <h:inputText value="#{buyAddress.id}" />
      City : <h:inputText value="#{buyAddress.cityName}" />
      GO : <h:commandButton value="Add New Buyer Address" action="#{testDataBindingManager.addNewSupplierAddress}" />

      </h:form>

      ...
      Here both @In properties of type TestAddress are neither being injected. In the case I use only one with the exact same name as the entity @Name("address") works fine.
      Please give me a clue how to make it work with both being injected in case not at the same time and another case not at the same time(if possible).
      I am really stuck :-)