On Mon, 10 Jan 2005 16:54:35 +0100 (CET), "Bruno Aranda - Dev"
<[EMAIL PROTECTED]> wrote :

> Hi Mark, I don't understand very well your problem but I think you have
> here a problem with hibernate, when saving the user there is a property of
> Center that is null and in your hibernate mapping files this property has
> the not-null="true" attribute...
> 
> I wish I could be more helpful... :-)
> 
> Bruno
> 

Thanks Bruno,

You are correct that center_id is set to not-null in the hibernate mapping
file because I should never have a user created who does not have a center_id.

The problem is that Center is null. When a UserBean object is created it
should instantiate Center and when a user picks a center from the menu:

        <h:selectOneMenu id="center" value="#{userBean.center.centerId}">
           <f:selectItems value="#{applicationBean.centerSelectItems}"/>
        </h:selectOneMenu>

The center.centerId should be set.

Then when the saveAction executes the UserBean's center.centerId property
should be set and should be copied from UserBean to an instance of User
which then gets saved by hibernate.

-Mark

Reply via email to