1 Reply Latest reply on Apr 29, 2006 4:43 PM by gavin.king

    POJO bijection

    francesco.mondora

      Hi all,
      I'm new to Seam and I'm starting in understanding how bijection works.

      Current scenario is:
      a jsf button is linked to a start() method on a session bean stateless where
      there is declared:
      @Out
      PojoA pojoA = new PojoA("frank pojo a");

      public String start() {
      PojoB b = new PojoB();
      b.doB();
      return "nothing by now";
      }


      PojoA is:
      @Name("pojoA")
      public class PojoA {

      public PojoA() {
      this.a="empty a";
      }

      private String a;

      public PojoA(String a) {
      this.a=a;
      }

      public void doA(String withWho){
      System.out.println("AAAA --> pojoa doing a with value: "+a+" from: "+withWho);
      }
      }

      and PojoB is:
      @Name("pojoB")
      public class PojoB {

      @In(create=true)
      PojoA pojoA;


      public PojoA getPojoA() {
      return pojoA;
      }

      public void setPojoA(PojoA pojoA) {
      this.pojoA = pojoA;
      }



      public void doB(){
      System.out.println("b doing b");
      this.getPojoA().doA("b");
      }

      }

      Everytime start() is called and pojoB is called, pojoA is not injected
      and the create=true annotation value is not considered throwing a NullPointerExcetpion (pojoA is null).

      I think I'm missing something.

      What am I missing?

      Thanks to all
      Frank