2 Replies Latest reply on Dec 21, 2011 12:00 PM by rogermorituesta.rogermori.yahoo.com

    How to apply Entity in conversation scope to field in EntityHome

    rafaelri

      Hi all,


      I am doing a proof of concept around Seam framework classes such as EntityHome, EntityQuery and etc. My POC is focused on finding out how complex can an application become without Java coding by using org.jboss.seam.framework classes.
      But I soon found one thing that I could not think of any alternatives that would avoid coding an EntityHome (instead of configuring one on components.xml). I have an entity that everytime the user persists a new instance I want to have one of its field filled with one information that is stored on a Session scoped variable (this variable is in fact the Account information). This session scoped variable is filled upon authentication.
      I've been able to have this implemented by using the following code:

       
      @Name("someEntryHome")
      public class SomeEntryHome extends HibernateEntityHome<SomeEntry>{
              @In
              private Account account;
              protected void initInstance() {
                      super.initInstance();
                      getInstance().setAccount(account);
              }
      } 


      But I was really wishing not to have to code for such a simple thing. I considered using the something.page.xml file for applying this value but I guess it is only able to apply values from request and since I had this on Session scope I won't be able to do what I wanted.


      Does anyone know any other way I could do this without resort to coding a custom EntityHome.


      best regards,


      Rafael Ribeiro