myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rene Guenther <rene.guent...@innflow.com>
Subject Hibernate ManyToOne and JSF SelectMenu
Date Fri, 14 Dec 2007 15:42:08 GMT

I got an manyToOne mapping from User to Cost Center.
On my userForm.jsf I got sth like

<t:selectOneMenu value="#{userForm.user.ccenter.id}" id="cc" required="true"
styleClass="select" />
       <f:selectItems value="#{ccManager.objects}" />
</t:selectOneMenu>

userForm.user.getCcenter() is "under control" of hibernate. If I select a
new cost center this results in a change of the value of
userForm.user.getCcenter().getId(). Before saving the user I have to
retrieve the new cost center object from the database. Until now everything
works.

Lets say I got for some reason another user object in my session. This user2
is assigned to the same cost center, this results to user.getCcenter() ==
user2.getCcenter(); not just equals. Now I might come into trouble if I
change the id of the cost center of user by selecting a new one with
selectOneMenu, because user2.getCcenter().getId() will be changed too of
course.

You know whether there is a recommended way how to use manyToOne mapping
together with a selectMenu?

Thanks
René

-- 
View this message in context: http://www.nabble.com/Hibernate-ManyToOne-and-JSF-SelectMenu-tp14338207p14338207.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Mime
View raw message