aspose file tools*
The moose likes JSF and the fly likes Updating model relationship using h:selectOneListbox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Updating model relationship using h:selectOneListbox" Watch "Updating model relationship using h:selectOneListbox" New topic
Author

Updating model relationship using h:selectOneListbox

Lonnie Lewis
Greenhorn

Joined: Mar 30, 2009
Posts: 8
I am populating a table (h:dataTable) with a Hibernate managed collection. The table is populated fine using:


When I make a change to the "make" in this example and submit the form, the "make" field is correctly updated for the appropriate object in the collection.

My problem is in updating the "carCondition" using the h:selectOneListbox. I can understand why it wouldn't work; changing the "id" field in the embedded "carCondition" object, when I would really want the database relationship changed.
How should this best be done? Am I missing an easy way to do this or in my "actionListener" method should I just read the form parameters, find the correct value (the selected "carCondition" id), find the correct CarCondition object and update the "car" object myself? Is there an easier way?
Karim Sherif
Greenhorn

Joined: Nov 05, 2009
Posts: 1
THANK YOU
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Updating model relationship using h:selectOneListbox