views:

18

answers:

0

I have a Struts2 application that uses Hibernate/Spring. I have created an update form using s:select form elements - as in:

Select form element is jsp - initialised correctly with current value:

<s:select name="model.titleType.id"
          value="%{model.titleType.id}"
          list="#titleTypeSelect.titleTypeMap" />

Hibernate mapping:

<many-to-one cascade="save-update" class="com.ets.model.TitleType" column="title_type_id" name="titleType" not-null="true" />

My action initialises object with correct TitleType object - with id only param set. An error is thrown because other params (not-null) are null.

Do I have to explicitly initialise my many-to-one objects within my action?

For example:

model.setTitleType(titleTypeDAO.get(id));

Many thanks,

Mark