FelderR wrote:
My question is why not persist the ActionForm objects themselves? Is there a notable drawback that I haven't seen yet?
Rene,
I am fairly new to Hibernate but I have a pretty decent background in Struts. While I cannot give you a perfect answer from the Hibernate perspective as to why the ActionForms cannot be used for persistence, I believe that from a Struts point of view it could be deemed as "improper" use of ActionForms. Reason being that the purpose of the ActionForms is solely to collect information from the user and pass it on to the Model to be used with the Business Layer for the application. The same argument could be made for not using ActionForms as the Model itself and passing it to any data persistence layer, be it JDBC or Hibernate. From an MVC architectural point of view I would think that mixing the ActionForms with the Model could possibly cause Design issues once the application gets big.
Personally, I prefer having DynaValidatorForms defined in the struts-config.xml and populate my individual beans with PropertyUtils.setProperty() and use the bean in my Business Layer for processing.