2 Replies Latest reply on Oct 20, 2010 7:55 AM by Thomas Hamacher

    Inject entity from database before form values are transferred

    Thomas Hamacher Novice

      Hi @all,

      I´m currently working with a Seam/Spring/Hibernate stack, so some of the easy Seam features won´t work as expected, so I´m looking for some workarounds.
      So please don´t ask yourself, what I´m trying to do, although Seam already provides this feature automatically.

      What I would like to do is to intercept between the injection of an entity into a Seam form bean and the subsequent calls to the entity´s setter to transfer the values from the form fields to.

      In my understanding Seam works as follows:
      1. Any entity which is marked with an @In-annotation will be injected into the Seam form bean at the beginning of a request-cycle
      2. Any values from the form-fields are set to the adequate attributes of the form bean as defined through the xhtml
      3. A method of my Seam form bean now has the injected entity with the correct values from the form and can do any business logic.

      In step one I have the chance to inject anything from the session or the request etc.
      But I would like to use the entity which is refreshed directly from the database, before step two is executed (and therefore is fully attached to the session). So from my side it could be a getter from the Seam form bean, which is called because it is annotated through a cool annotation or maybe some kind of interceptor that is called in that life-cycle. What I currently need is a way to intercept into that process and I don´t know if there is a way to do so.

      If someone has an idea and would let me know I would really appriciate it.

      Greetings from Germany