3 Replies Latest reply on Dec 6, 2005 10:13 AM by Martin Henderson

    Validation and long running conversations

    Martin Henderson Newbie

      Hi there,
      I'm having some diffs with my validation in a conversation...

      I have a main object Property that is composed of an address object.

      @Entity
      @Name("property")
      public class Property implements Serializable
      {
       /**
       * Default Constructor.
       */
       public Property()
       {
       }
      
       /**
       * Get the property identifier.
       */
       @Id(generate=GeneratorType.AUTO)
       public Integer getId()
       {
       return id;
       }
      
       /**
       * Set the property identifier.
       */
       public void setId(Integer id)
       {
       this.id = id;
       }
      
       /**
       * Get the address
       */
       @OneToOne(cascade = CascadeType.ALL)
       @NotNull(message="Please supply the address of the property.")
       public Address getAddress()
       {
       return address;
       }
      
       /**
       * Set the address.
       *
       * @pre address != null
       * @post The address for <code>this</code> has been set.
       */
       public void setAddress(Address address)
       {
       this.address = address;
       }
      
       /**
       * The property attributes
       */
       private int id;
      
       @Valid
       private Address address = new Address();
      
      
       /**
       * Is logger for this class.
       */
       private static final Logger log = Logger.getLogger(Property.class);
      }
      


      and the flow is that a user clicks initiateRegistration then the data is entered via the jsf page so the function to register this looks like:
       @Begin
       public String initiateRegistration()
       {
       this.property = new Property();
       log.info("started registration");
       return "registrationStarted";
       }
      
       @IfInvalid(outcome=REDISPLAY)
       @End
       public String register()
       {
       log.info("address=" + property.getAddress());
       log.info("person=" + property.getOwner());
       log.info("ownerAddress=" + property.getOwner().getAddress());
      
       propertyDatabase.persist(property);
       propertyDatabase.flush();
       result = "success";
       return result;
       }
      
       @In(required=false)
       @Out(required=false)
       @Valid
       private Property property;
      


      what I'm seeing is that the validation works on attributes on the Property class, but when it validates deeper into the Address object it seems to kill the conversation.

      Anyone seen this before or have a workaround..?
      Hope you can help.

      Marty