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

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3910905#3910905

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3910905


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to