Hi

I'm having the same problem. I have a class named Survey which
contains a list of SurveyReplicates (see code below).  My app edits
both the Survey and the SurveyReplicates then sends the whole lot to
the server.

@Entity
public class Survey {
        .....

        @OneToMany(mappedBy="survey", fetch=FetchType.EAGER)
        public List<SurveyReplicate> getSurveyReplicates() {
                return surveyReplicates;
        }
}

Much like the OP, when persist is called on the parent object Survey,
none of the survey replicates are persisted.  A little debugging shows
that none of the updates arrive in the SurveyReplicates in the
persist() method on Survey, however the JSON sent to the server
contains the updates to the SurveyReplicates.  Updates to the Survey
do arrive.

I wonder if anyone could tell me if persisting object graphs with one-
to-many relationships is supported?
I'm using GWT tip-of-trunk, but saw the same behaviour in 2.1.0.

Thanks

Will Temperley


On Nov 11, 2:49 pm, agi <agata.p...@gmail.com> wrote:
> Hello,
>
> I've started to useRequestFactoryin my project, but I have following
> problem.
>
> I have  Classes
>
> class Professor
> {
> @ManyToMany(...)
>  List<Subject> subjects;
> ///setters getters etc
>
> }
>
> I  have created all needed architecture (Proxys, Requests etc)
>
> In my application I do :
> 1) I am fetching List of all Subjects  from the database.
>  final SubjectRequest request =requestFactory.subjectRequest();
>   request.findAll().fire( new Receiver<List<SubjectProxy>>() ...
>
> It works just fine.
>
> 2) Then I am creating new instance of Professor
>
>       request =requestFactory.professorRequest();
>       professor = request.create( ProfessornProxy.class );
>      professor.setSubjects(new ArrayList<Subject>());
>
>      // subject is taken from the list which was downloaded before
>     professor.getSubjects().add(subject);
>
> 3) then i want to save it into database
>
> request.save().using( professor ).fire( new Receiver<Void>() ...
>
> 4) Unfortunately the list of subjects isn't propagated to the server
> side.. When I look on Professor class in the debug on the server side
> I see only empty array. So the  Professor is saved into database but
> without any dependencies to Subjects
>
> Besides on FireBug console in POST Responce I see message
>
> {"result":null,"sideEffects":{"DELETE":[{"!
> id":"org.test.subjectpr...@185"}]},"related":{}}
>
> Can somebody tell me what I am doing wrong? and how to save Professor
> class properly with all lists?
> I have also tried to use with("subjects") but it didn't help..
>
> greetings,
> agata

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to