2 Replies Latest reply on Nov 14, 2008 9:56 AM by accless

    Differences between @PostCreate and @Create

    accless

      I always thought that the PostCreate (applied on a seam-pojo!!!) is the equvialent of @Create (applied on a seam-pojo). But it seems not. Let me explain.


      On my pojo extending from EntityQuery I use the @PostCreate as a workaround for setting the restrictions (remember @Create is already in use by the Query-class).


      My code looks like this:



       
          @In
          private AbstractCompanySuggBoxController abstractCompanySuggBoxController;
           
          @Logger
          private Log log; 
      
          @PostConstruct
          public void initRestrictions() {
               this.log.info("init restrictions");
               
               this.log.info("AbstractCompany: #0", this.abstractCompanySuggBoxController);        <===== Log available, but NOT my Pojo!!!
               super.setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS));         
      }




      Later my pojo is available




          @Override
          public String getRenderedEjbql() {
               this.log.info("abstract: #0", this.abstractCompanySuggBoxController);             <===== NOW my pojo is available!!!
               return super.getRenderedEjbql();
          }
      



      So, why is the @Logger available after @PostConstruct, but my pojo not??? The thing is when I use @Create (and overriding the validate-Method in class Query)
      the logger AND pojo are injected properly.


      greetings