Hmmm ... So you would work with a SimpleFormController? I think I have tried
this in the past and couldn't get it to work because of Validation. IOW,
Spring Validates my CompanyForm, as if it were performing a Save/Update and
craps out because none of this info is sent, only the idCompany and
idEmployee(s).

I guess I could turn off validation ... not sure how ... but that seems like
a kludge. You think this is the best way to go about it?

Thanks,
Bob


Michael Horwitz wrote:
> 
> As a rule I ALWAYS work with a command object. In the example you cite
> below
> the command object would be the company and the controller would add the
> employees to the appropriate collection on the company object. Hibernate
> handles all of the writing to the mapping table, etc. There are occasions
> where I got directly to JDBC but these are few and far between and
> normally
> involve some sort of bulk operation.
> 
> Mike.
> 
> 
> On 8/13/07, syg6 <[EMAIL PROTECTED]> wrote:
>>
>>
>> When you have a simple list you use a Controller and when you are doing
>> CRUD
>> a SimpleFormController.
>>
>> But let's say you have an Object Company that has a Collection of
>> Employees.
>> When you CRUD a Company you use a SimpleFormController. But when you want
>> to
>> add an Employee to a Company, you open a page with a drop-down of
>> Employees.
>> You select one, or many and click on Submit.
>>
>> Now what? You wouldn't use a SimpleFormController because this assumes
>> that
>> your Command Object (Company) will be mapped to the form and saved in the
>> companies table in the database. What you need to do is save the id's of
>> the
>> Company and Employee in the companiesemployees table, for which no
>> Command
>> Object exists.
>>
>> If, for example, your companiesemployees table had other attributes, like
>> salary, then you'd have to create a CompanyEmployee Object to do the
>> CRUD,
>> in which case I guess you wouldn't have this problem. But for
>> simplicity's
>> sake, let's say we don't have attributes, and as such, don't have a
>> CompanyEmployee Object.
>>
>> What's the best way to save this relation? I am sure I could come up with
>> a
>> kludge solution and get it to work, but I was just wondering what the
>> experts say...
>>
>> Many thanks!
>> Bob
>> --
>> View this message in context:
>> http://www.nabble.com/Best-practices%3A-Which-Spring-MVC-Form-to-use--tf4259684s2369.html#a12122214
>> Sent from the AppFuse - User mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Best-practices%3A-Which-Spring-MVC-Form-to-use--tf4259684s2369.html#a12122610
Sent from the AppFuse - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to