Do you maybe have cascade="save-update" set on the survey.questions
association?   Removing that might help.   This survey.questions also
would typically have inverse="true" where question has a survey
association that points back to survey.   

 

It seems like for some reason hibernate is trying to persist the
"survey.questions" property when it changes.  It should rather ignore
changes made to that property (which it will do if inverse="true" is
set).  Things behave better with a 1-many association when you use a
bi-directional association where the many side has "inverse=true". 

 

Jeff

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of ggyao2005
Sent: Friday, November 02, 2007 12:32 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] conflicts resolution for flex data service and
hibernate

 

I have two classes, Survey and Question. Both of them have "version" 
attribute. Class Survey reference a collection of Question.

When I add new Question object into the collection reference in Survey, 
then I commit. e.g. 

surveyServiceervice.fill(surveys, "survey.all", []);
var survey:Survey = surveys.getItemAt(0);
var question:Question = new Question();
survey.questions.addItem(question);
surveyService.commit([survey], true);

in my database, I see the new question object persisted, with foreign 
key pointing to the survey. I also see the question has a version 
number of 1. 

Here is my headache: all the other question objects in the 
survey.questions have their version number increase by 1. But they are 
not reflected in the client (browser) side. This makes all my client 
side data obsolete.

I wonder whether this is the "supposed" behavior of hibernate&flex? if 
not, what configuration attributes I need to take care of?

Thanks a lot!

York

 

Reply via email to