Should not happen the eventLoginAffect should get the value from the form
and since there is no value for Createur it should set to a default
valur or null
unless you have also a field: <x:selectOneMenu id="eventLoginAffect"
referencing Createur
with the same id ans the one referencing the eventLoginAffect object
MyFaces should cry in this instance, but I do not know how older
versions behave in those circumstances.

what also strikes me is that you just set the values not the objects ids
thus you only can make a create on the hibernate side not an update
which also might be the cause of the prolem


Nicolas GENSOLLEN wrote:
> I give you some details :
>  
> hibernate mapping :
> 
> <many-to-one name="eventLoginCreateur" column="util_login_createur"
> class="Utilisateur" not-null="true"/>
> 
> <many-to-one name="eventLoginAffect" column="util_login_affect"
> class="Utilisateur" not-null="true" />
> 
> java class :
>  
> public abstract class AbstractEvenement
>     implements Serializable
> {
>     
>     private Utilisateur eventLoginCreateur;
>     
>     private Utilisateur eventLoginAffect;
>  
>     public Utilisateur getEventLoginCreateur()
>     {
>         return this.eventLoginCreateur;
>     }
>  
>     public void setEventLoginCreateur(Utilisateur utilisateur6)
>     {
>         this.eventLoginCreateur = utilisateur6;
>     }
>  
>     public Utilisateur getEventLoginAffect()
>     {
>         return this.eventLoginAffect;
>     }
>  
>     public void setEventLoginAffect(Utilisateur utilisateur7)
>     {
>         this.eventLoginAffect = utilisateur7;
>     }
> }
>  
> and the jsp page :
> 
> <x:selectOneMenu id="eventLoginAffect"
> 
> value="#{mementoBean.evenement.eventLoginAffect.utilLogin}"
> 
> styleClass="form-selector-1line">
> 
> <f:selectItems value="#{mementoBean.usersListe}" />
> 
> </x:selectOneMenu>
> 
> So, when the eventLoginAffect is submitted, the eventLoginCreateur take
> the same value. I think it's because the 2 properties point to same java
> object but I don't know how to change this...
>  
>  
> ----- Original Message -----
> From: "Werner Punz" <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>
> To: <[email protected] <mailto:[email protected]>>
> Sent: Tuesday, September 20, 2005 9:26 PM
> Subject: Re: Fw: JSF - SPRING - HIBERNATE Mapping problem
> 
>> can you point me towards that post, maybe I can figure
>> out on what is going on.
>>
>> werner
>>
>>
>> Nicolas GENSOLLEN wrote:
>>> I thought so too before i read a post in forum.hibernate.org.
>>> A man had the same problem and was saying it wasn't a hibernate but a
>>> struts problem.
>>>
>>> So, i wondered if the same problem would not exist with JSF ...
>>>
>>> Thank you.
>>>
>>> ----- Original Message ----- From: "Werner Punz" <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>>
>>> To: <[email protected] <mailto:[email protected]>>
>>> Sent: Tuesday, September 20, 2005 9:38 AM
>>> Subject: Re: Fw: JSF - SPRING - HIBERNATE Mapping problem
>>>
>>>
>>>> This is a question which I would ask in forum.hibernate.org
>>>> because it is very Hibernate specific and neither has anything
>>>> to do with spring or with JSF,
>>>> could be that both properties reference a dataset with the same key in
>>>> the database
>>>> hence both get updated at the same time.
>>>>
>>>>
>>>>
>>>> Werner
>>>>
>>>>
>>>>
>>>> Nicolas GENSOLLEN wrote:
>>>>
>>>>> Hi everybody, first excuse me for my poor english.
>>>>>
>>>>> I use JSF with Spring and Hibernate and I have the following problem :
>>>>>
>>>>> i ve a class with two many-to-one relations which have the same bean
>>>>> associated.
>>>>>
>>>>> This works fine, but , my problems is when i m trying to update the
>>>>> class and the two beans have the same values, since then hibernate
>>>>> always update both beans with similar values, independently of the
>>>>> values you set to the first bean, hibernate always update database with
>>>>> the values of the second one.
>>>>>
>>>>> The hibernate mapping look likes that :
>>>>>
>>>>> <many-to-one name="name1"  column="columnA" *class*="com.classeA"/>
>>>>> <many-to-one name="name2" column="columnB" *class*="com.classA"/>
>>>>>
>>>>> If someone has the same problem...
>>>>>
>>>>> Thank you for your help.
>>>>>
>>>>
>>>
>>>
>>

Reply via email to