How to set up a form in a Spring app that pulls data from different tables

I'm developing a Spring web app and am hoping someone can give me some advice. Currently I've got a form that when submitted populates a simple POJO that is stored in a database. That POJO needs to be a little more complex though by being tied to two other POJOS.

So for instance I have a Job class that needs to hold an instance of a WorkOrder class and an Authorization class. On the form I would like 2 drop down boxes populated with the name fields of those two classes and in the DB I will simply store the Ids of the respective rows in their respective tables in the Job table. Not sure if I need to actually create foreign key relationships or anything. Anyway, I believe I read something about this when I was first learning Spring a month ago but I haven't yet needed it in my development so haven't used it and can't seem to find it again. What is the proper way to do this? As much help as someone could provide would be great, or if you can point me to the right resources I would appreciate it. One note, I am looking for answers using Spring 3, not older versions. This often seems to be a problem when I'm researching stuff as I guess understandably there is more info on Spring 2 and such.

Hopefully my question makes sense. Thanks to all.

Answers


May I did not understand the question correct.

If you have forms with fields that can not be mapped 1:1 to an Entity then you should use an other custom Object to hold the form data (A simple POJO Bean.) often called Command-Class.

In the form submit controller you then need somehow deal with this Command. Mainly Converting the data from the command to the domain entities.

BTW: Even it there is an 1:1 mapping you may want to use form/usecase specific commands instead of the Domain Entities, for an clear architecture.


Need Your Help

css styling, change one image styling, not all of them

html css image

I'm really new to CSS and I have a sticky header menu with our company's logo in it where the menu and the image shrink to 48 pixels high once the user scrolls down. My code I use to shrink the log...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.