1 Reply Latest reply on Dec 9, 2005 5:01 PM by patrick_ibg

    Maintaining Relationships with JSF/Seam

      I'm just starting my journey into JSF and like what I see with the Seam additions so far. In our application we have a fairly rich data model. In the GUI, the user is allowed to assign/modify relationships fairly easily. For example, we have an order object:

      pulic class Order{
      private Person billToPerson;
      ...snip other properties...

      public Person getBillToPerson(){ return billToPerson;}
      public void setBillToPerson(Person person){ this.billToPerson = person;}

      }

      A typical use case is for an order entry user to be taking an order and ask the user for their account number (which is there person id).

      When the user is creating/editing an OrderEdit.jsp, they can assign a value to a field on the jsp called billToPerson.id. Our current Struts code gets the value from the ActionForm, loads the object from the database (error handling if the id is not valid) and then assigns the loaded Person to the Order.billToPerson property.

      There is obviously a lot of glue code here (we have written extension for Struts that help). As we move to JSF (possible using Seam), we are looking to reduce the glue code as much as we can.

      I was wondering if/how Seam might help with assigning/changing relationships on objects (particularly when the user can enter an abitrary ID). Or what others do in this type of situation.

      Thanks in advance for any comments,
      Chris....

        • 1. Re: Maintaining Relationships with JSF/Seam
          patrick_ibg

          That problem isn't really handled by the seam layer, but by Hibernate or EJB3.

          However, you might find that because you don't have to derive from ActionForms anymore, your entities (Order, Person, etc.) can be used to hold form data on the JSF layer, so alot of the glue code goes away...