4 Replies Latest reply on Apr 14, 2008 4:35 PM by jmoreira

    Home beans and Stateful action listeners



      perhaps the title isn't very explicit but my question is this:

      right now i'm coding a user registration wizard. there are 2 entity beans, a User and a Profile (User has a Profile, like in Seam wiki).

      the 1st screen edit's the user info and the 2nd the profile info. the user cannot be persisted before all the data is filled because the Profile is required and has required properties.

      There are 2 view's, userRegister.xhtml and userRegisterProfile.xhtml

      Like in dvdstore demo, i have created a UserRegister stateful bean with 2 methods, registerUserInfo() and registerUserProfile() and a @In User property. I can bind the views and the methods using a jPDL pageflow definition, and validate the data in those methods, cool!

      My real question is, how does a UserHome component relate to this process, is it required? Or more exactly, how do Home objects relate to statefull/less java beans? can i manage the UserHome instance instead of a User property of RegisterAction?

      Because persistence will be activated in the UserRegister bean i suppose.



        • 1. Re: Home beans and Stateful action listeners

          You can think of a home object as providing the necessary methods for CRUD - you certainly don't have to use them - most of the examples don't...

          • 2. Re: Home beans and Stateful action listeners


            i coded the wizard using a Stateful EJB because i initially thought i needed it for only flushing after completion of registration (conversation end) and keeping state between requests and it worked.

            After giving it some more thought and understanding the process a bit more, i changed to a Home object that calls userHome.persist() after jpdl completion and after battling conversation propagations and correct action linking, i got it to work.

            Right now i'm coding Home objects that delegate database logic to simple DAO's and it's working so i'll stick with it for now :)

            i'm really loving the programming model.


            • 3. Re: Home beans and Stateful action listeners

              That seems counter intuitive to me - Home objects are really a generic DAO pattern.

              • 4. Re: Home beans and Stateful action listeners

                hum i see. i was following seam wiki example. i this case i see the dao's more like helper classes for hql related stuff and database logic, i'm using home beans as actions listeners. im still on the learning curve :)